diff --git a/virtcontainers/pkg/firecracker/README b/virtcontainers/pkg/firecracker/README new file mode 100644 index 0000000000..bb042cdd44 --- /dev/null +++ b/virtcontainers/pkg/firecracker/README @@ -0,0 +1,17 @@ +This directory and sub directories contain generated code. + +The code is generated via go-swagger + +https://github.com/go-swagger/go-swagger#licensing + +``` +swagger generate model -f ./firecracker-experimental.yaml --model-package=client/models --client-package=client +swagger generate client -f ./firecracker-experimental.yaml --model-package=client/models --client-package=client +``` + +``` +The toolkit itself is licensed as Apache Software License 2.0. Just like swagger, this does not cover code generated by the toolkit. +That code is entirely yours to license however you see fit. +``` + +The generated code is also licensed under Apache Software License 2.0 diff --git a/virtcontainers/pkg/firecracker/client/firecracker_client.go b/virtcontainers/pkg/firecracker/client/firecracker_client.go new file mode 100644 index 0000000000..e4b462c0a0 --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/firecracker_client.go @@ -0,0 +1,117 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package client + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + + strfmt "github.com/go-openapi/strfmt" + + "github.com/kata-containers/runtime/virtcontainers/pkg/firecracker/client/operations" +) + +// Default firecracker HTTP client. +var Default = NewHTTPClient(nil) + +const ( + // DefaultHost is the default Host + // found in Meta (info) section of spec file + DefaultHost string = "localhost" + // DefaultBasePath is the default BasePath + // found in Meta (info) section of spec file + DefaultBasePath string = "/" +) + +// DefaultSchemes are the default schemes found in Meta (info) section of spec file +var DefaultSchemes = []string{"http"} + +// NewHTTPClient creates a new firecracker HTTP client. +func NewHTTPClient(formats strfmt.Registry) *Firecracker { + return NewHTTPClientWithConfig(formats, nil) +} + +// NewHTTPClientWithConfig creates a new firecracker HTTP client, +// using a customizable transport config. +func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *Firecracker { + // ensure nullable parameters have default + if cfg == nil { + cfg = DefaultTransportConfig() + } + + // create transport and client + transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes) + return New(transport, formats) +} + +// New creates a new firecracker client +func New(transport runtime.ClientTransport, formats strfmt.Registry) *Firecracker { + // ensure nullable parameters have default + if formats == nil { + formats = strfmt.Default + } + + cli := new(Firecracker) + cli.Transport = transport + + cli.Operations = operations.New(transport, formats) + + return cli +} + +// DefaultTransportConfig creates a TransportConfig with the +// default settings taken from the meta section of the spec file. +func DefaultTransportConfig() *TransportConfig { + return &TransportConfig{ + Host: DefaultHost, + BasePath: DefaultBasePath, + Schemes: DefaultSchemes, + } +} + +// TransportConfig contains the transport related info, +// found in the meta section of the spec file. +type TransportConfig struct { + Host string + BasePath string + Schemes []string +} + +// WithHost overrides the default host, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithHost(host string) *TransportConfig { + cfg.Host = host + return cfg +} + +// WithBasePath overrides the default basePath, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig { + cfg.BasePath = basePath + return cfg +} + +// WithSchemes overrides the default schemes, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig { + cfg.Schemes = schemes + return cfg +} + +// Firecracker is a client for firecracker +type Firecracker struct { + Operations *operations.Client + + Transport runtime.ClientTransport +} + +// SetTransport changes the transport on the client and all its subresources +func (c *Firecracker) SetTransport(transport runtime.ClientTransport) { + c.Transport = transport + + c.Operations.SetTransport(transport) + +} diff --git a/virtcontainers/pkg/firecracker/client/models/boot_source.go b/virtcontainers/pkg/firecracker/client/models/boot_source.go new file mode 100644 index 0000000000..ca336b38e5 --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/models/boot_source.go @@ -0,0 +1,67 @@ +// 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" +) + +// BootSource Boot source descriptor. +// swagger:model BootSource +type BootSource struct { + + // Kernel boot arguments + BootArgs string `json:"boot_args,omitempty"` + + // Host level path to the kernel image used to boot the guest + // Required: true + KernelImagePath *string `json:"kernel_image_path"` +} + +// Validate validates this boot source +func (m *BootSource) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateKernelImagePath(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *BootSource) validateKernelImagePath(formats strfmt.Registry) error { + + if err := validate.Required("kernel_image_path", "body", m.KernelImagePath); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *BootSource) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *BootSource) UnmarshalBinary(b []byte) error { + var res BootSource + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/virtcontainers/pkg/firecracker/client/models/cpu_template.go b/virtcontainers/pkg/firecracker/client/models/cpu_template.go new file mode 100644 index 0000000000..4d234a419f --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/models/cpu_template.go @@ -0,0 +1,63 @@ +// 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/validate" +) + +// CPUTemplate The CPU Template defines a set of flags to be disabled from the microvm so that the features exposed to the guest are the same as in the selected instance type. +// swagger:model CpuTemplate +type CPUTemplate string + +const ( + + // CPUTemplateC3 captures enum value "C3" + CPUTemplateC3 CPUTemplate = "C3" + + // CPUTemplateT2 captures enum value "T2" + CPUTemplateT2 CPUTemplate = "T2" +) + +// for schema +var cpuTemplateEnum []interface{} + +func init() { + var res []CPUTemplate + if err := json.Unmarshal([]byte(`["C3","T2"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + cpuTemplateEnum = append(cpuTemplateEnum, v) + } +} + +func (m CPUTemplate) validateCPUTemplateEnum(path, location string, value CPUTemplate) error { + if err := validate.Enum(path, location, value, cpuTemplateEnum); err != nil { + return err + } + return nil +} + +// Validate validates this Cpu template +func (m CPUTemplate) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateCPUTemplateEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/virtcontainers/pkg/firecracker/client/models/drive.go b/virtcontainers/pkg/firecracker/client/models/drive.go new file mode 100644 index 0000000000..01d15b0aa6 --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/models/drive.go @@ -0,0 +1,143 @@ +// 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" +) + +// Drive drive +// swagger:model Drive +type Drive struct { + + // drive id + // Required: true + DriveID *string `json:"drive_id"` + + // is read only + // Required: true + IsReadOnly *bool `json:"is_read_only"` + + // is root device + // Required: true + IsRootDevice *bool `json:"is_root_device"` + + // 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. + Partuuid string `json:"partuuid,omitempty"` + + // Host level path for the guest drive + // Required: true + PathOnHost *string `json:"path_on_host"` + + // rate limiter + RateLimiter *RateLimiter `json:"rate_limiter,omitempty"` +} + +// Validate validates this drive +func (m *Drive) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDriveID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateIsReadOnly(formats); err != nil { + res = append(res, err) + } + + if err := m.validateIsRootDevice(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePathOnHost(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRateLimiter(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Drive) validateDriveID(formats strfmt.Registry) error { + + if err := validate.Required("drive_id", "body", m.DriveID); err != nil { + return err + } + + return nil +} + +func (m *Drive) validateIsReadOnly(formats strfmt.Registry) error { + + if err := validate.Required("is_read_only", "body", m.IsReadOnly); err != nil { + return err + } + + return nil +} + +func (m *Drive) validateIsRootDevice(formats strfmt.Registry) error { + + if err := validate.Required("is_root_device", "body", m.IsRootDevice); err != nil { + return err + } + + return nil +} + +func (m *Drive) validatePathOnHost(formats strfmt.Registry) error { + + if err := validate.Required("path_on_host", "body", m.PathOnHost); err != nil { + return err + } + + return nil +} + +func (m *Drive) validateRateLimiter(formats strfmt.Registry) error { + + if swag.IsZero(m.RateLimiter) { // not required + return nil + } + + if m.RateLimiter != nil { + if err := m.RateLimiter.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rate_limiter") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Drive) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Drive) UnmarshalBinary(b []byte) error { + var res Drive + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/virtcontainers/pkg/firecracker/client/models/error.go b/virtcontainers/pkg/firecracker/client/models/error.go new file mode 100644 index 0000000000..58e4fde78e --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/models/error.go @@ -0,0 +1,44 @@ +// 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" +) + +// Error error +// swagger:model Error +type Error struct { + + // A description of the error condition + // Read Only: true + FaultMessage string `json:"fault_message,omitempty"` +} + +// Validate validates this error +func (m *Error) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Error) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Error) UnmarshalBinary(b []byte) error { + var res Error + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/virtcontainers/pkg/firecracker/client/models/instance_action_info.go b/virtcontainers/pkg/firecracker/client/models/instance_action_info.go new file mode 100644 index 0000000000..0e9fac242d --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/models/instance_action_info.go @@ -0,0 +1,110 @@ +// 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" +) + +// InstanceActionInfo Variant wrapper containing the real action. +// swagger:model InstanceActionInfo +type InstanceActionInfo struct { + + // Enumeration indicating what type of action is contained in the payload + // Required: true + // Enum: [BlockDeviceRescan FlushMetrics InstanceStart SendCtrlAltDel] + ActionType *string `json:"action_type"` + + // payload + Payload string `json:"payload,omitempty"` +} + +// Validate validates this instance action info +func (m *InstanceActionInfo) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateActionType(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +var instanceActionInfoTypeActionTypePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["BlockDeviceRescan","FlushMetrics","InstanceStart","SendCtrlAltDel"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + instanceActionInfoTypeActionTypePropEnum = append(instanceActionInfoTypeActionTypePropEnum, v) + } +} + +const ( + + // InstanceActionInfoActionTypeBlockDeviceRescan captures enum value "BlockDeviceRescan" + InstanceActionInfoActionTypeBlockDeviceRescan string = "BlockDeviceRescan" + + // InstanceActionInfoActionTypeFlushMetrics captures enum value "FlushMetrics" + InstanceActionInfoActionTypeFlushMetrics string = "FlushMetrics" + + // InstanceActionInfoActionTypeInstanceStart captures enum value "InstanceStart" + InstanceActionInfoActionTypeInstanceStart string = "InstanceStart" + + // InstanceActionInfoActionTypeSendCtrlAltDel captures enum value "SendCtrlAltDel" + InstanceActionInfoActionTypeSendCtrlAltDel string = "SendCtrlAltDel" +) + +// prop value enum +func (m *InstanceActionInfo) validateActionTypeEnum(path, location string, value string) error { + if err := validate.Enum(path, location, value, instanceActionInfoTypeActionTypePropEnum); err != nil { + return err + } + return nil +} + +func (m *InstanceActionInfo) validateActionType(formats strfmt.Registry) error { + + if err := validate.Required("action_type", "body", m.ActionType); err != nil { + return err + } + + // value enum + if err := m.validateActionTypeEnum("action_type", "body", *m.ActionType); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceActionInfo) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceActionInfo) UnmarshalBinary(b []byte) error { + var res InstanceActionInfo + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/virtcontainers/pkg/firecracker/client/models/instance_info.go b/virtcontainers/pkg/firecracker/client/models/instance_info.go new file mode 100644 index 0000000000..972eff8d41 --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/models/instance_info.go @@ -0,0 +1,144 @@ +// 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" +) + +// InstanceInfo Describes MicroVM instance information. +// swagger:model InstanceInfo +type InstanceInfo struct { + + // 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 Halting Halted] + State *string `json:"state"` + + // MicroVM hypervisor build version. + // Required: true + VmmVersion *string `json:"vmm_version"` +} + +// Validate validates this instance info +func (m *InstanceInfo) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateID(formats); err != nil { + 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) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceInfo) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +var instanceInfoTypeStatePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["Uninitialized","Starting","Running","Halting","Halted"]`), &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" + + // InstanceInfoStateHalting captures enum value "Halting" + InstanceInfoStateHalting string = "Halting" + + // InstanceInfoStateHalted captures enum value "Halted" + InstanceInfoStateHalted string = "Halted" +) + +// 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 { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceInfo) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceInfo) UnmarshalBinary(b []byte) error { + var res InstanceInfo + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/virtcontainers/pkg/firecracker/client/models/logger.go b/virtcontainers/pkg/firecracker/client/models/logger.go new file mode 100644 index 0000000000..c656b42ba9 --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/models/logger.go @@ -0,0 +1,149 @@ +// 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" +) + +// Logger Describes the configuration option for the logging capability. +// swagger:model Logger +type Logger struct { + + // Set the level. + // Enum: [Error Warning Info Debug] + Level *string `json:"level,omitempty"` + + // The named pipe 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"` + + // Additional logging options. Only "LogDirtyPages" is supported. + Options []string `json:"options"` + + // Whether or not to output the level in the logs. + ShowLevel *bool `json:"show_level,omitempty"` + + // Whether or not to include the file path and line number of the log's origin. + ShowLogOrigin *bool `json:"show_log_origin,omitempty"` +} + +// Validate validates this logger +func (m *Logger) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateLevel(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLogFifo(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMetricsFifo(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +var loggerTypeLevelPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["Error","Warning","Info","Debug"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + loggerTypeLevelPropEnum = append(loggerTypeLevelPropEnum, v) + } +} + +const ( + + // LoggerLevelError captures enum value "Error" + LoggerLevelError string = "Error" + + // LoggerLevelWarning captures enum value "Warning" + LoggerLevelWarning string = "Warning" + + // LoggerLevelInfo captures enum value "Info" + LoggerLevelInfo string = "Info" + + // LoggerLevelDebug captures enum value "Debug" + LoggerLevelDebug string = "Debug" +) + +// prop value enum +func (m *Logger) validateLevelEnum(path, location string, value string) error { + if err := validate.Enum(path, location, value, loggerTypeLevelPropEnum); err != nil { + return err + } + return nil +} + +func (m *Logger) validateLevel(formats strfmt.Registry) error { + + if swag.IsZero(m.Level) { // not required + return nil + } + + // value enum + if err := m.validateLevelEnum("level", "body", *m.Level); err != nil { + return err + } + + return nil +} + +func (m *Logger) validateLogFifo(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 { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Logger) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Logger) UnmarshalBinary(b []byte) error { + var res Logger + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/virtcontainers/pkg/firecracker/client/models/machine_configuration.go b/virtcontainers/pkg/firecracker/client/models/machine_configuration.go new file mode 100644 index 0000000000..642b4a9ea5 --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/models/machine_configuration.go @@ -0,0 +1,131 @@ +// 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" +) + +// MachineConfiguration Describes the number of vCPUs, memory size, Hyperthreading capabilities and the CPU template. +// swagger:model MachineConfiguration +type MachineConfiguration struct { + + // cpu template + CPUTemplate CPUTemplate `json:"cpu_template,omitempty"` + + // Flag for enabling/disabling Hyperthreading + // Required: true + HtEnabled *bool `json:"ht_enabled"` + + // Memory size of VM + // Required: true + MemSizeMib *int64 `json:"mem_size_mib"` + + // Number of vCPUs (either 1 or an even number) + // Required: true + // Maximum: 32 + // Minimum: 1 + VcpuCount *int64 `json:"vcpu_count"` +} + +// Validate validates this machine configuration +func (m *MachineConfiguration) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCPUTemplate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateHtEnabled(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMemSizeMib(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVcpuCount(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MachineConfiguration) validateCPUTemplate(formats strfmt.Registry) error { + + if swag.IsZero(m.CPUTemplate) { // not required + return nil + } + + if err := m.CPUTemplate.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cpu_template") + } + return err + } + + return nil +} + +func (m *MachineConfiguration) validateHtEnabled(formats strfmt.Registry) error { + + if err := validate.Required("ht_enabled", "body", m.HtEnabled); err != nil { + return err + } + + return nil +} + +func (m *MachineConfiguration) validateMemSizeMib(formats strfmt.Registry) error { + + if err := validate.Required("mem_size_mib", "body", m.MemSizeMib); err != nil { + return err + } + + return nil +} + +func (m *MachineConfiguration) validateVcpuCount(formats strfmt.Registry) error { + + if err := validate.Required("vcpu_count", "body", m.VcpuCount); err != nil { + return err + } + + if err := validate.MinimumInt("vcpu_count", "body", int64(*m.VcpuCount), 1, false); err != nil { + return err + } + + if err := validate.MaximumInt("vcpu_count", "body", int64(*m.VcpuCount), 32, false); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *MachineConfiguration) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *MachineConfiguration) UnmarshalBinary(b []byte) error { + var res MachineConfiguration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/virtcontainers/pkg/firecracker/client/models/network_interface.go b/virtcontainers/pkg/firecracker/client/models/network_interface.go new file mode 100644 index 0000000000..62d037fe01 --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/models/network_interface.go @@ -0,0 +1,137 @@ +// 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" +) + +// NetworkInterface Defines a network interface. +// swagger:model NetworkInterface +type NetworkInterface struct { + + // If this field is set, the device model will reply to HTTP GET requests sent to the MMDS address via this interface. In this case, 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. + AllowMmdsRequests bool `json:"allow_mmds_requests,omitempty"` + + // guest mac + GuestMac string `json:"guest_mac,omitempty"` + + // Host level path for the guest network interface + // Required: true + HostDevName *string `json:"host_dev_name"` + + // iface id + // Required: true + IfaceID *string `json:"iface_id"` + + // rx rate limiter + RxRateLimiter *RateLimiter `json:"rx_rate_limiter,omitempty"` + + // tx rate limiter + TxRateLimiter *RateLimiter `json:"tx_rate_limiter,omitempty"` +} + +// Validate validates this network interface +func (m *NetworkInterface) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateHostDevName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateIfaceID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRxRateLimiter(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTxRateLimiter(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkInterface) validateHostDevName(formats strfmt.Registry) error { + + if err := validate.Required("host_dev_name", "body", m.HostDevName); err != nil { + return err + } + + return nil +} + +func (m *NetworkInterface) validateIfaceID(formats strfmt.Registry) error { + + if err := validate.Required("iface_id", "body", m.IfaceID); err != nil { + return err + } + + return nil +} + +func (m *NetworkInterface) validateRxRateLimiter(formats strfmt.Registry) error { + + if swag.IsZero(m.RxRateLimiter) { // not required + return nil + } + + if m.RxRateLimiter != nil { + if err := m.RxRateLimiter.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rx_rate_limiter") + } + return err + } + } + + return nil +} + +func (m *NetworkInterface) validateTxRateLimiter(formats strfmt.Registry) error { + + if swag.IsZero(m.TxRateLimiter) { // not required + return nil + } + + if m.TxRateLimiter != nil { + if err := m.TxRateLimiter.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tx_rate_limiter") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkInterface) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkInterface) UnmarshalBinary(b []byte) error { + var res NetworkInterface + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/virtcontainers/pkg/firecracker/client/models/partial_drive.go b/virtcontainers/pkg/firecracker/client/models/partial_drive.go new file mode 100644 index 0000000000..d30f6523ea --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/models/partial_drive.go @@ -0,0 +1,81 @@ +// 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" +) + +// PartialDrive partial drive +// swagger:model PartialDrive +type PartialDrive struct { + + // drive id + // Required: true + DriveID *string `json:"drive_id"` + + // Host level path for the guest drive + // Required: true + PathOnHost *string `json:"path_on_host"` +} + +// Validate validates this partial drive +func (m *PartialDrive) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDriveID(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePathOnHost(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialDrive) validateDriveID(formats strfmt.Registry) error { + + if err := validate.Required("drive_id", "body", m.DriveID); err != nil { + return err + } + + return nil +} + +func (m *PartialDrive) validatePathOnHost(formats strfmt.Registry) error { + + if err := validate.Required("path_on_host", "body", m.PathOnHost); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PartialDrive) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PartialDrive) UnmarshalBinary(b []byte) error { + var res PartialDrive + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/virtcontainers/pkg/firecracker/client/models/partial_network_interface.go b/virtcontainers/pkg/firecracker/client/models/partial_network_interface.go new file mode 100644 index 0000000000..821135dadf --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/models/partial_network_interface.go @@ -0,0 +1,114 @@ +// 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" +) + +// PartialNetworkInterface Defines a partial network interface structure, used to update the rate limiters for that interface, after microvm start. +// swagger:model PartialNetworkInterface +type PartialNetworkInterface struct { + + // iface id + // Required: true + IfaceID *string `json:"iface_id"` + + // rx rate limiter + RxRateLimiter *RateLimiter `json:"rx_rate_limiter,omitempty"` + + // tx rate limiter + TxRateLimiter *RateLimiter `json:"tx_rate_limiter,omitempty"` +} + +// Validate validates this partial network interface +func (m *PartialNetworkInterface) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateIfaceID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRxRateLimiter(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTxRateLimiter(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialNetworkInterface) validateIfaceID(formats strfmt.Registry) error { + + if err := validate.Required("iface_id", "body", m.IfaceID); err != nil { + return err + } + + return nil +} + +func (m *PartialNetworkInterface) validateRxRateLimiter(formats strfmt.Registry) error { + + if swag.IsZero(m.RxRateLimiter) { // not required + return nil + } + + if m.RxRateLimiter != nil { + if err := m.RxRateLimiter.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rx_rate_limiter") + } + return err + } + } + + return nil +} + +func (m *PartialNetworkInterface) validateTxRateLimiter(formats strfmt.Registry) error { + + if swag.IsZero(m.TxRateLimiter) { // not required + return nil + } + + if m.TxRateLimiter != nil { + if err := m.TxRateLimiter.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tx_rate_limiter") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PartialNetworkInterface) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PartialNetworkInterface) UnmarshalBinary(b []byte) error { + var res PartialNetworkInterface + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/virtcontainers/pkg/firecracker/client/models/rate_limiter.go b/virtcontainers/pkg/firecracker/client/models/rate_limiter.go new file mode 100644 index 0000000000..a4e96bf8b6 --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/models/rate_limiter.go @@ -0,0 +1,96 @@ +// 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" +) + +// RateLimiter Defines an IO rate limiter with independent bytes/s and ops/s limits. Limits are defined by configuring each of the _bandwidth_ and _ops_ token buckets. +// swagger:model RateLimiter +type RateLimiter struct { + + // Token bucket with bytes as tokens + Bandwidth *TokenBucket `json:"bandwidth,omitempty"` + + // Token bucket with operations as tokens + Ops *TokenBucket `json:"ops,omitempty"` +} + +// Validate validates this rate limiter +func (m *RateLimiter) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBandwidth(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOps(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *RateLimiter) validateBandwidth(formats strfmt.Registry) error { + + if swag.IsZero(m.Bandwidth) { // not required + return nil + } + + if m.Bandwidth != nil { + if err := m.Bandwidth.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("bandwidth") + } + return err + } + } + + return nil +} + +func (m *RateLimiter) validateOps(formats strfmt.Registry) error { + + if swag.IsZero(m.Ops) { // not required + return nil + } + + if m.Ops != nil { + if err := m.Ops.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ops") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *RateLimiter) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *RateLimiter) UnmarshalBinary(b []byte) error { + var res RateLimiter + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/virtcontainers/pkg/firecracker/client/models/token_bucket.go b/virtcontainers/pkg/firecracker/client/models/token_bucket.go new file mode 100644 index 0000000000..52e616eb6d --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/models/token_bucket.go @@ -0,0 +1,112 @@ +// 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" +) + +// TokenBucket Defines a token bucket with a maximum capacity (size), an initial burst size (one_time_burst) and an interval for refilling purposes (refill_time). The refill-rate is derived from size and refill_time, and it is the constant rate at which the tokens replenish. The refill process only starts happening after the initial burst budget is consumed. Consumption from the token bucket is unbounded in speed which allows for bursts bound in size by the amount of tokens available. Once the token bucket is empty, consumption speed is bound by the refill_rate. +// swagger:model TokenBucket +type TokenBucket struct { + + // The initial size of a token bucket. + // Minimum: 0 + OneTimeBurst *int64 `json:"one_time_burst,omitempty"` + + // The amount of milliseconds it takes for the bucket to refill. + // Required: true + // Minimum: 0 + RefillTime *int64 `json:"refill_time"` + + // The total number of tokens this bucket can hold. + // Required: true + // Minimum: 0 + Size *int64 `json:"size"` +} + +// Validate validates this token bucket +func (m *TokenBucket) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateOneTimeBurst(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRefillTime(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSize(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TokenBucket) validateOneTimeBurst(formats strfmt.Registry) error { + + if swag.IsZero(m.OneTimeBurst) { // not required + return nil + } + + if err := validate.MinimumInt("one_time_burst", "body", int64(*m.OneTimeBurst), 0, false); err != nil { + return err + } + + return nil +} + +func (m *TokenBucket) validateRefillTime(formats strfmt.Registry) error { + + if err := validate.Required("refill_time", "body", m.RefillTime); err != nil { + return err + } + + if err := validate.MinimumInt("refill_time", "body", int64(*m.RefillTime), 0, false); err != nil { + return err + } + + return nil +} + +func (m *TokenBucket) validateSize(formats strfmt.Registry) error { + + if err := validate.Required("size", "body", m.Size); err != nil { + return err + } + + if err := validate.MinimumInt("size", "body", int64(*m.Size), 0, false); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *TokenBucket) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TokenBucket) UnmarshalBinary(b []byte) error { + var res TokenBucket + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/virtcontainers/pkg/firecracker/client/models/vsock.go b/virtcontainers/pkg/firecracker/client/models/vsock.go new file mode 100644 index 0000000000..750d8852f6 --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/models/vsock.go @@ -0,0 +1,86 @@ +// 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" +) + +// Vsock vsock +// swagger:model Vsock +type Vsock struct { + + // Guest Vsock CID + // Required: true + // Minimum: 3 + GuestCid *int64 `json:"guest_cid"` + + // id + // Required: true + ID *string `json:"id"` +} + +// Validate validates this vsock +func (m *Vsock) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateGuestCid(formats); err != nil { + res = append(res, err) + } + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Vsock) validateGuestCid(formats strfmt.Registry) error { + + if err := validate.Required("guest_cid", "body", m.GuestCid); err != nil { + return err + } + + if err := validate.MinimumInt("guest_cid", "body", int64(*m.GuestCid), 3, false); err != nil { + return err + } + + return nil +} + +func (m *Vsock) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Vsock) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Vsock) UnmarshalBinary(b []byte) error { + var res Vsock + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/virtcontainers/pkg/firecracker/client/operations/create_sync_action_parameters.go b/virtcontainers/pkg/firecracker/client/operations/create_sync_action_parameters.go new file mode 100644 index 0000000000..1e54dc1313 --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/operations/create_sync_action_parameters.go @@ -0,0 +1,136 @@ +// 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/runtime/virtcontainers/pkg/firecracker/client/models" +) + +// NewCreateSyncActionParams creates a new CreateSyncActionParams object +// with the default values initialized. +func NewCreateSyncActionParams() *CreateSyncActionParams { + var () + return &CreateSyncActionParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewCreateSyncActionParamsWithTimeout creates a new CreateSyncActionParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewCreateSyncActionParamsWithTimeout(timeout time.Duration) *CreateSyncActionParams { + var () + return &CreateSyncActionParams{ + + timeout: timeout, + } +} + +// NewCreateSyncActionParamsWithContext creates a new CreateSyncActionParams object +// with the default values initialized, and the ability to set a context for a request +func NewCreateSyncActionParamsWithContext(ctx context.Context) *CreateSyncActionParams { + var () + return &CreateSyncActionParams{ + + Context: ctx, + } +} + +// NewCreateSyncActionParamsWithHTTPClient creates a new CreateSyncActionParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewCreateSyncActionParamsWithHTTPClient(client *http.Client) *CreateSyncActionParams { + var () + return &CreateSyncActionParams{ + HTTPClient: client, + } +} + +/*CreateSyncActionParams contains all the parameters to send to the API endpoint +for the create sync action operation typically these are written to a http.Request +*/ +type CreateSyncActionParams struct { + + /*Info*/ + Info *models.InstanceActionInfo + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the create sync action params +func (o *CreateSyncActionParams) WithTimeout(timeout time.Duration) *CreateSyncActionParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the create sync action params +func (o *CreateSyncActionParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the create sync action params +func (o *CreateSyncActionParams) WithContext(ctx context.Context) *CreateSyncActionParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the create sync action params +func (o *CreateSyncActionParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the create sync action params +func (o *CreateSyncActionParams) WithHTTPClient(client *http.Client) *CreateSyncActionParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the create sync action params +func (o *CreateSyncActionParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithInfo adds the info to the create sync action params +func (o *CreateSyncActionParams) WithInfo(info *models.InstanceActionInfo) *CreateSyncActionParams { + o.SetInfo(info) + return o +} + +// SetInfo adds the info to the create sync action params +func (o *CreateSyncActionParams) SetInfo(info *models.InstanceActionInfo) { + o.Info = info +} + +// WriteToRequest writes these params to a swagger request +func (o *CreateSyncActionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Info != nil { + if err := r.SetBodyParam(o.Info); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/virtcontainers/pkg/firecracker/client/operations/create_sync_action_responses.go b/virtcontainers/pkg/firecracker/client/operations/create_sync_action_responses.go new file mode 100644 index 0000000000..58cdb44d81 --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/operations/create_sync_action_responses.go @@ -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/runtime/virtcontainers/pkg/firecracker/client/models" +) + +// CreateSyncActionReader is a Reader for the CreateSyncAction structure. +type CreateSyncActionReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CreateSyncActionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 204: + result := NewCreateSyncActionNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 400: + result := NewCreateSyncActionBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + result := NewCreateSyncActionDefault(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 + } +} + +// NewCreateSyncActionNoContent creates a CreateSyncActionNoContent with default headers values +func NewCreateSyncActionNoContent() *CreateSyncActionNoContent { + return &CreateSyncActionNoContent{} +} + +/*CreateSyncActionNoContent handles this case with default header values. + +The update was successful +*/ +type CreateSyncActionNoContent struct { +} + +func (o *CreateSyncActionNoContent) Error() string { + return fmt.Sprintf("[PUT /actions][%d] createSyncActionNoContent ", 204) +} + +func (o *CreateSyncActionNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewCreateSyncActionBadRequest creates a CreateSyncActionBadRequest with default headers values +func NewCreateSyncActionBadRequest() *CreateSyncActionBadRequest { + return &CreateSyncActionBadRequest{} +} + +/*CreateSyncActionBadRequest handles this case with default header values. + +The action cannot be executed due to bad input +*/ +type CreateSyncActionBadRequest struct { + Payload *models.Error +} + +func (o *CreateSyncActionBadRequest) Error() string { + return fmt.Sprintf("[PUT /actions][%d] createSyncActionBadRequest %+v", 400, o.Payload) +} + +func (o *CreateSyncActionBadRequest) 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 +} + +// NewCreateSyncActionDefault creates a CreateSyncActionDefault with default headers values +func NewCreateSyncActionDefault(code int) *CreateSyncActionDefault { + return &CreateSyncActionDefault{ + _statusCode: code, + } +} + +/*CreateSyncActionDefault handles this case with default header values. + +Internal Server Error +*/ +type CreateSyncActionDefault struct { + _statusCode int + + Payload *models.Error +} + +// Code gets the status code for the create sync action default response +func (o *CreateSyncActionDefault) Code() int { + return o._statusCode +} + +func (o *CreateSyncActionDefault) Error() string { + return fmt.Sprintf("[PUT /actions][%d] createSyncAction default %+v", o._statusCode, o.Payload) +} + +func (o *CreateSyncActionDefault) 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 +} diff --git a/virtcontainers/pkg/firecracker/client/operations/describe_instance_parameters.go b/virtcontainers/pkg/firecracker/client/operations/describe_instance_parameters.go new file mode 100644 index 0000000000..130938fce8 --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/operations/describe_instance_parameters.go @@ -0,0 +1,113 @@ +// 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" +) + +// NewDescribeInstanceParams creates a new DescribeInstanceParams object +// with the default values initialized. +func NewDescribeInstanceParams() *DescribeInstanceParams { + + return &DescribeInstanceParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewDescribeInstanceParamsWithTimeout creates a new DescribeInstanceParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewDescribeInstanceParamsWithTimeout(timeout time.Duration) *DescribeInstanceParams { + + return &DescribeInstanceParams{ + + timeout: timeout, + } +} + +// NewDescribeInstanceParamsWithContext creates a new DescribeInstanceParams object +// with the default values initialized, and the ability to set a context for a request +func NewDescribeInstanceParamsWithContext(ctx context.Context) *DescribeInstanceParams { + + return &DescribeInstanceParams{ + + Context: ctx, + } +} + +// NewDescribeInstanceParamsWithHTTPClient creates a new DescribeInstanceParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewDescribeInstanceParamsWithHTTPClient(client *http.Client) *DescribeInstanceParams { + + return &DescribeInstanceParams{ + HTTPClient: client, + } +} + +/*DescribeInstanceParams contains all the parameters to send to the API endpoint +for the describe instance operation typically these are written to a http.Request +*/ +type DescribeInstanceParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the describe instance params +func (o *DescribeInstanceParams) WithTimeout(timeout time.Duration) *DescribeInstanceParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the describe instance params +func (o *DescribeInstanceParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the describe instance params +func (o *DescribeInstanceParams) WithContext(ctx context.Context) *DescribeInstanceParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the describe instance params +func (o *DescribeInstanceParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the describe instance params +func (o *DescribeInstanceParams) WithHTTPClient(client *http.Client) *DescribeInstanceParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the describe instance params +func (o *DescribeInstanceParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *DescribeInstanceParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/virtcontainers/pkg/firecracker/client/operations/describe_instance_responses.go b/virtcontainers/pkg/firecracker/client/operations/describe_instance_responses.go new file mode 100644 index 0000000000..3c63f9dd4a --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/operations/describe_instance_responses.go @@ -0,0 +1,112 @@ +// 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/runtime/virtcontainers/pkg/firecracker/client/models" +) + +// DescribeInstanceReader is a Reader for the DescribeInstance structure. +type DescribeInstanceReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DescribeInstanceReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewDescribeInstanceOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + result := NewDescribeInstanceDefault(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 + } +} + +// NewDescribeInstanceOK creates a DescribeInstanceOK with default headers values +func NewDescribeInstanceOK() *DescribeInstanceOK { + return &DescribeInstanceOK{} +} + +/*DescribeInstanceOK handles this case with default header values. + +The instance information +*/ +type DescribeInstanceOK struct { + Payload *models.InstanceInfo +} + +func (o *DescribeInstanceOK) Error() string { + return fmt.Sprintf("[GET /][%d] describeInstanceOK %+v", 200, o.Payload) +} + +func (o *DescribeInstanceOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.InstanceInfo) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDescribeInstanceDefault creates a DescribeInstanceDefault with default headers values +func NewDescribeInstanceDefault(code int) *DescribeInstanceDefault { + return &DescribeInstanceDefault{ + _statusCode: code, + } +} + +/*DescribeInstanceDefault handles this case with default header values. + +Internal Server Error +*/ +type DescribeInstanceDefault struct { + _statusCode int + + Payload *models.Error +} + +// Code gets the status code for the describe instance default response +func (o *DescribeInstanceDefault) Code() int { + return o._statusCode +} + +func (o *DescribeInstanceDefault) Error() string { + return fmt.Sprintf("[GET /][%d] describeInstance default %+v", o._statusCode, o.Payload) +} + +func (o *DescribeInstanceDefault) 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 +} diff --git a/virtcontainers/pkg/firecracker/client/operations/get_machine_configuration_parameters.go b/virtcontainers/pkg/firecracker/client/operations/get_machine_configuration_parameters.go new file mode 100644 index 0000000000..41516e44be --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/operations/get_machine_configuration_parameters.go @@ -0,0 +1,113 @@ +// 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" +) + +// NewGetMachineConfigurationParams creates a new GetMachineConfigurationParams object +// with the default values initialized. +func NewGetMachineConfigurationParams() *GetMachineConfigurationParams { + + return &GetMachineConfigurationParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetMachineConfigurationParamsWithTimeout creates a new GetMachineConfigurationParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetMachineConfigurationParamsWithTimeout(timeout time.Duration) *GetMachineConfigurationParams { + + return &GetMachineConfigurationParams{ + + timeout: timeout, + } +} + +// NewGetMachineConfigurationParamsWithContext creates a new GetMachineConfigurationParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetMachineConfigurationParamsWithContext(ctx context.Context) *GetMachineConfigurationParams { + + return &GetMachineConfigurationParams{ + + Context: ctx, + } +} + +// NewGetMachineConfigurationParamsWithHTTPClient creates a new GetMachineConfigurationParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetMachineConfigurationParamsWithHTTPClient(client *http.Client) *GetMachineConfigurationParams { + + return &GetMachineConfigurationParams{ + HTTPClient: client, + } +} + +/*GetMachineConfigurationParams contains all the parameters to send to the API endpoint +for the get machine configuration operation typically these are written to a http.Request +*/ +type GetMachineConfigurationParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get machine configuration params +func (o *GetMachineConfigurationParams) WithTimeout(timeout time.Duration) *GetMachineConfigurationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get machine configuration params +func (o *GetMachineConfigurationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get machine configuration params +func (o *GetMachineConfigurationParams) WithContext(ctx context.Context) *GetMachineConfigurationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get machine configuration params +func (o *GetMachineConfigurationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get machine configuration params +func (o *GetMachineConfigurationParams) WithHTTPClient(client *http.Client) *GetMachineConfigurationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get machine configuration params +func (o *GetMachineConfigurationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *GetMachineConfigurationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/virtcontainers/pkg/firecracker/client/operations/get_machine_configuration_responses.go b/virtcontainers/pkg/firecracker/client/operations/get_machine_configuration_responses.go new file mode 100644 index 0000000000..e9bff0f89e --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/operations/get_machine_configuration_responses.go @@ -0,0 +1,112 @@ +// 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/runtime/virtcontainers/pkg/firecracker/client/models" +) + +// GetMachineConfigurationReader is a Reader for the GetMachineConfiguration structure. +type GetMachineConfigurationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetMachineConfigurationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewGetMachineConfigurationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + result := NewGetMachineConfigurationDefault(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 + } +} + +// NewGetMachineConfigurationOK creates a GetMachineConfigurationOK with default headers values +func NewGetMachineConfigurationOK() *GetMachineConfigurationOK { + return &GetMachineConfigurationOK{} +} + +/*GetMachineConfigurationOK handles this case with default header values. + +OK +*/ +type GetMachineConfigurationOK struct { + Payload *models.MachineConfiguration +} + +func (o *GetMachineConfigurationOK) Error() string { + return fmt.Sprintf("[GET /machine-config][%d] getMachineConfigurationOK %+v", 200, o.Payload) +} + +func (o *GetMachineConfigurationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.MachineConfiguration) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetMachineConfigurationDefault creates a GetMachineConfigurationDefault with default headers values +func NewGetMachineConfigurationDefault(code int) *GetMachineConfigurationDefault { + return &GetMachineConfigurationDefault{ + _statusCode: code, + } +} + +/*GetMachineConfigurationDefault handles this case with default header values. + +Internal server error +*/ +type GetMachineConfigurationDefault struct { + _statusCode int + + Payload *models.Error +} + +// Code gets the status code for the get machine configuration default response +func (o *GetMachineConfigurationDefault) Code() int { + return o._statusCode +} + +func (o *GetMachineConfigurationDefault) Error() string { + return fmt.Sprintf("[GET /machine-config][%d] getMachineConfiguration default %+v", o._statusCode, o.Payload) +} + +func (o *GetMachineConfigurationDefault) 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 +} diff --git a/virtcontainers/pkg/firecracker/client/operations/get_mmds_parameters.go b/virtcontainers/pkg/firecracker/client/operations/get_mmds_parameters.go new file mode 100644 index 0000000000..97f5fa5648 --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/operations/get_mmds_parameters.go @@ -0,0 +1,113 @@ +// 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" +) + +// NewGetMmdsParams creates a new GetMmdsParams object +// with the default values initialized. +func NewGetMmdsParams() *GetMmdsParams { + + return &GetMmdsParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetMmdsParamsWithTimeout creates a new GetMmdsParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetMmdsParamsWithTimeout(timeout time.Duration) *GetMmdsParams { + + return &GetMmdsParams{ + + timeout: timeout, + } +} + +// NewGetMmdsParamsWithContext creates a new GetMmdsParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetMmdsParamsWithContext(ctx context.Context) *GetMmdsParams { + + return &GetMmdsParams{ + + Context: ctx, + } +} + +// NewGetMmdsParamsWithHTTPClient creates a new GetMmdsParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetMmdsParamsWithHTTPClient(client *http.Client) *GetMmdsParams { + + return &GetMmdsParams{ + HTTPClient: client, + } +} + +/*GetMmdsParams contains all the parameters to send to the API endpoint +for the get mmds operation typically these are written to a http.Request +*/ +type GetMmdsParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get mmds params +func (o *GetMmdsParams) WithTimeout(timeout time.Duration) *GetMmdsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get mmds params +func (o *GetMmdsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get mmds params +func (o *GetMmdsParams) WithContext(ctx context.Context) *GetMmdsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get mmds params +func (o *GetMmdsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get mmds params +func (o *GetMmdsParams) WithHTTPClient(client *http.Client) *GetMmdsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get mmds params +func (o *GetMmdsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *GetMmdsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/virtcontainers/pkg/firecracker/client/operations/get_mmds_responses.go b/virtcontainers/pkg/firecracker/client/operations/get_mmds_responses.go new file mode 100644 index 0000000000..4119bf8ef3 --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/operations/get_mmds_responses.go @@ -0,0 +1,146 @@ +// 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/runtime/virtcontainers/pkg/firecracker/client/models" +) + +// GetMmdsReader is a Reader for the GetMmds structure. +type GetMmdsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetMmdsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewGetMmdsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 400: + result := NewGetMmdsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + result := NewGetMmdsDefault(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 + } +} + +// NewGetMmdsOK creates a GetMmdsOK with default headers values +func NewGetMmdsOK() *GetMmdsOK { + return &GetMmdsOK{} +} + +/*GetMmdsOK handles this case with default header values. + +The MMDS data store JSON. +*/ +type GetMmdsOK struct { + Payload interface{} +} + +func (o *GetMmdsOK) Error() string { + return fmt.Sprintf("[GET /mmds][%d] getMmdsOK %+v", 200, o.Payload) +} + +func (o *GetMmdsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetMmdsBadRequest creates a GetMmdsBadRequest with default headers values +func NewGetMmdsBadRequest() *GetMmdsBadRequest { + return &GetMmdsBadRequest{} +} + +/*GetMmdsBadRequest handles this case with default header values. + +Cannot get the MMDS data store due to bad input. +*/ +type GetMmdsBadRequest struct { + Payload *models.Error +} + +func (o *GetMmdsBadRequest) Error() string { + return fmt.Sprintf("[GET /mmds][%d] getMmdsBadRequest %+v", 400, o.Payload) +} + +func (o *GetMmdsBadRequest) 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 +} + +// NewGetMmdsDefault creates a GetMmdsDefault with default headers values +func NewGetMmdsDefault(code int) *GetMmdsDefault { + return &GetMmdsDefault{ + _statusCode: code, + } +} + +/*GetMmdsDefault handles this case with default header values. + +Internal server error +*/ +type GetMmdsDefault struct { + _statusCode int + + Payload *models.Error +} + +// Code gets the status code for the get mmds default response +func (o *GetMmdsDefault) Code() int { + return o._statusCode +} + +func (o *GetMmdsDefault) Error() string { + return fmt.Sprintf("[GET /mmds][%d] GetMmds default %+v", o._statusCode, o.Payload) +} + +func (o *GetMmdsDefault) 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 +} diff --git a/virtcontainers/pkg/firecracker/client/operations/operations_client.go b/virtcontainers/pkg/firecracker/client/operations/operations_client.go new file mode 100644 index 0000000000..94aec10b7e --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/operations/operations_client.go @@ -0,0 +1,474 @@ +// 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 ( + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// New creates a new operations API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { + return &Client{transport: transport, formats: formats} +} + +/* +Client for operations API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +/* +GetMmds gets the m m d s data store +*/ +func (a *Client) GetMmds(params *GetMmdsParams) (*GetMmdsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetMmdsParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "GetMmds", + Method: "GET", + PathPattern: "/mmds", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetMmdsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*GetMmdsOK), nil + +} + +/* +PatchMmds updates the m m d s data store +*/ +func (a *Client) PatchMmds(params *PatchMmdsParams) (*PatchMmdsNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchMmdsParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "PatchMmds", + Method: "PATCH", + PathPattern: "/mmds", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchMmdsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PatchMmdsNoContent), nil + +} + +/* +PutMmds creates a m m d s microvm metadata service data store +*/ +func (a *Client) PutMmds(params *PutMmdsParams) (*PutMmdsNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPutMmdsParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "PutMmds", + Method: "PUT", + PathPattern: "/mmds", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PutMmdsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PutMmdsNoContent), nil + +} + +/* +CreateSyncAction creates a synchronous action +*/ +func (a *Client) CreateSyncAction(params *CreateSyncActionParams) (*CreateSyncActionNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewCreateSyncActionParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "createSyncAction", + Method: "PUT", + PathPattern: "/actions", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &CreateSyncActionReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*CreateSyncActionNoContent), nil + +} + +/* +DescribeInstance returns general information about an instance +*/ +func (a *Client) DescribeInstance(params *DescribeInstanceParams) (*DescribeInstanceOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDescribeInstanceParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "describeInstance", + Method: "GET", + PathPattern: "/", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DescribeInstanceReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*DescribeInstanceOK), nil + +} + +/* +GetMachineConfiguration gets the machine configuration of the VM + +Gets the machine configuration of the VM. When called before the PUT operation, it will return the default values for the vCPU count (=1), memory size (=128 MiB). By default Hyperthreading is disabled and there is no CPU Template. +*/ +func (a *Client) GetMachineConfiguration(params *GetMachineConfigurationParams) (*GetMachineConfigurationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetMachineConfigurationParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "getMachineConfiguration", + Method: "GET", + PathPattern: "/machine-config", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetMachineConfigurationReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*GetMachineConfigurationOK), nil + +} + +/* +PatchGuestDriveByID updates the properties of a drive + +Updates the properties of the drive with the ID specified by drive_id path parameter. Will fail if update is not possible. +*/ +func (a *Client) PatchGuestDriveByID(params *PatchGuestDriveByIDParams) (*PatchGuestDriveByIDNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchGuestDriveByIDParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "patchGuestDriveByID", + Method: "PATCH", + PathPattern: "/drives/{drive_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchGuestDriveByIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PatchGuestDriveByIDNoContent), nil + +} + +/* +PatchGuestNetworkInterfaceByID updates the rate limiters applied to a network interface + +Updates the rate limiters applied to a network interface. +*/ +func (a *Client) PatchGuestNetworkInterfaceByID(params *PatchGuestNetworkInterfaceByIDParams) (*PatchGuestNetworkInterfaceByIDNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchGuestNetworkInterfaceByIDParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "patchGuestNetworkInterfaceByID", + Method: "PATCH", + PathPattern: "/network-interfaces/{iface_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchGuestNetworkInterfaceByIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PatchGuestNetworkInterfaceByIDNoContent), nil + +} + +/* +PatchMachineConfiguration partiallies updates the machine configuration of the VM + +Partially updates the Virtual Machine Configuration with the specified input. If any of the parameters has an incorrect value, the whole update fails. +*/ +func (a *Client) PatchMachineConfiguration(params *PatchMachineConfigurationParams) (*PatchMachineConfigurationNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchMachineConfigurationParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "patchMachineConfiguration", + Method: "PATCH", + PathPattern: "/machine-config", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchMachineConfigurationReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PatchMachineConfigurationNoContent), nil + +} + +/* +PutGuestBootSource creates or updates the boot source + +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. +*/ +func (a *Client) PutGuestBootSource(params *PutGuestBootSourceParams) (*PutGuestBootSourceNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPutGuestBootSourceParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "putGuestBootSource", + Method: "PUT", + PathPattern: "/boot-source", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PutGuestBootSourceReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PutGuestBootSourceNoContent), nil + +} + +/* +PutGuestDriveByID creates or updates a drive + +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. +*/ +func (a *Client) PutGuestDriveByID(params *PutGuestDriveByIDParams) (*PutGuestDriveByIDNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPutGuestDriveByIDParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "putGuestDriveByID", + Method: "PUT", + PathPattern: "/drives/{drive_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PutGuestDriveByIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PutGuestDriveByIDNoContent), nil + +} + +/* +PutGuestNetworkInterfaceByID creates a network interface + +Creates new network interface with ID specified by iface_id path parameter. +*/ +func (a *Client) PutGuestNetworkInterfaceByID(params *PutGuestNetworkInterfaceByIDParams) (*PutGuestNetworkInterfaceByIDNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPutGuestNetworkInterfaceByIDParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "putGuestNetworkInterfaceByID", + Method: "PUT", + PathPattern: "/network-interfaces/{iface_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PutGuestNetworkInterfaceByIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PutGuestNetworkInterfaceByIDNoContent), nil + +} + +/* +PutGuestVsockByID creates new vsock with ID specified by the id parameter + +If the vsock device with the specified ID already exists, its body will be updated based on the new input. May fail if update is not possible. +*/ +func (a *Client) PutGuestVsockByID(params *PutGuestVsockByIDParams) (*PutGuestVsockByIDCreated, *PutGuestVsockByIDNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPutGuestVsockByIDParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "putGuestVsockByID", + Method: "PUT", + PathPattern: "/vsocks/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PutGuestVsockByIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, nil, err + } + switch value := result.(type) { + case *PutGuestVsockByIDCreated: + return value, nil, nil + case *PutGuestVsockByIDNoContent: + return nil, value, nil + } + return nil, nil, nil + +} + +/* +PutLogger initializes the logger by specifying two named pipes i e for the logs and metrics output +*/ +func (a *Client) PutLogger(params *PutLoggerParams) (*PutLoggerNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPutLoggerParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "putLogger", + Method: "PUT", + PathPattern: "/logger", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PutLoggerReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PutLoggerNoContent), nil + +} + +/* +PutMachineConfiguration updates the machine configuration of the VM + +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. +*/ +func (a *Client) PutMachineConfiguration(params *PutMachineConfigurationParams) (*PutMachineConfigurationNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPutMachineConfigurationParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "putMachineConfiguration", + Method: "PUT", + PathPattern: "/machine-config", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PutMachineConfigurationReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PutMachineConfigurationNoContent), nil + +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/virtcontainers/pkg/firecracker/client/operations/patch_guest_drive_by_id_parameters.go b/virtcontainers/pkg/firecracker/client/operations/patch_guest_drive_by_id_parameters.go new file mode 100644 index 0000000000..66faa12226 --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/operations/patch_guest_drive_by_id_parameters.go @@ -0,0 +1,160 @@ +// 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/runtime/virtcontainers/pkg/firecracker/client/models" +) + +// NewPatchGuestDriveByIDParams creates a new PatchGuestDriveByIDParams object +// with the default values initialized. +func NewPatchGuestDriveByIDParams() *PatchGuestDriveByIDParams { + var () + return &PatchGuestDriveByIDParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPatchGuestDriveByIDParamsWithTimeout creates a new PatchGuestDriveByIDParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPatchGuestDriveByIDParamsWithTimeout(timeout time.Duration) *PatchGuestDriveByIDParams { + var () + return &PatchGuestDriveByIDParams{ + + timeout: timeout, + } +} + +// NewPatchGuestDriveByIDParamsWithContext creates a new PatchGuestDriveByIDParams object +// with the default values initialized, and the ability to set a context for a request +func NewPatchGuestDriveByIDParamsWithContext(ctx context.Context) *PatchGuestDriveByIDParams { + var () + return &PatchGuestDriveByIDParams{ + + Context: ctx, + } +} + +// NewPatchGuestDriveByIDParamsWithHTTPClient creates a new PatchGuestDriveByIDParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPatchGuestDriveByIDParamsWithHTTPClient(client *http.Client) *PatchGuestDriveByIDParams { + var () + return &PatchGuestDriveByIDParams{ + HTTPClient: client, + } +} + +/*PatchGuestDriveByIDParams contains all the parameters to send to the API endpoint +for the patch guest drive by ID operation typically these are written to a http.Request +*/ +type PatchGuestDriveByIDParams struct { + + /*Body + Guest drive properties + + */ + Body *models.PartialDrive + /*DriveID + The id of the guest drive + + */ + DriveID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the patch guest drive by ID params +func (o *PatchGuestDriveByIDParams) WithTimeout(timeout time.Duration) *PatchGuestDriveByIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch guest drive by ID params +func (o *PatchGuestDriveByIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch guest drive by ID params +func (o *PatchGuestDriveByIDParams) WithContext(ctx context.Context) *PatchGuestDriveByIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch guest drive by ID params +func (o *PatchGuestDriveByIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch guest drive by ID params +func (o *PatchGuestDriveByIDParams) WithHTTPClient(client *http.Client) *PatchGuestDriveByIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch guest drive by ID params +func (o *PatchGuestDriveByIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the patch guest drive by ID params +func (o *PatchGuestDriveByIDParams) WithBody(body *models.PartialDrive) *PatchGuestDriveByIDParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch guest drive by ID params +func (o *PatchGuestDriveByIDParams) SetBody(body *models.PartialDrive) { + o.Body = body +} + +// WithDriveID adds the driveID to the patch guest drive by ID params +func (o *PatchGuestDriveByIDParams) WithDriveID(driveID string) *PatchGuestDriveByIDParams { + o.SetDriveID(driveID) + return o +} + +// SetDriveID adds the driveId to the patch guest drive by ID params +func (o *PatchGuestDriveByIDParams) SetDriveID(driveID string) { + o.DriveID = driveID +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchGuestDriveByIDParams) 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 + } + } + + // path param drive_id + if err := r.SetPathParam("drive_id", o.DriveID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/virtcontainers/pkg/firecracker/client/operations/patch_guest_drive_by_id_responses.go b/virtcontainers/pkg/firecracker/client/operations/patch_guest_drive_by_id_responses.go new file mode 100644 index 0000000000..672473f838 --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/operations/patch_guest_drive_by_id_responses.go @@ -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/runtime/virtcontainers/pkg/firecracker/client/models" +) + +// PatchGuestDriveByIDReader is a Reader for the PatchGuestDriveByID structure. +type PatchGuestDriveByIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchGuestDriveByIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 204: + result := NewPatchGuestDriveByIDNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 400: + result := NewPatchGuestDriveByIDBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + result := NewPatchGuestDriveByIDDefault(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 + } +} + +// NewPatchGuestDriveByIDNoContent creates a PatchGuestDriveByIDNoContent with default headers values +func NewPatchGuestDriveByIDNoContent() *PatchGuestDriveByIDNoContent { + return &PatchGuestDriveByIDNoContent{} +} + +/*PatchGuestDriveByIDNoContent handles this case with default header values. + +Drive updated +*/ +type PatchGuestDriveByIDNoContent struct { +} + +func (o *PatchGuestDriveByIDNoContent) Error() string { + return fmt.Sprintf("[PATCH /drives/{drive_id}][%d] patchGuestDriveByIdNoContent ", 204) +} + +func (o *PatchGuestDriveByIDNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPatchGuestDriveByIDBadRequest creates a PatchGuestDriveByIDBadRequest with default headers values +func NewPatchGuestDriveByIDBadRequest() *PatchGuestDriveByIDBadRequest { + return &PatchGuestDriveByIDBadRequest{} +} + +/*PatchGuestDriveByIDBadRequest handles this case with default header values. + +Drive cannot be updated due to bad input +*/ +type PatchGuestDriveByIDBadRequest struct { + Payload *models.Error +} + +func (o *PatchGuestDriveByIDBadRequest) Error() string { + return fmt.Sprintf("[PATCH /drives/{drive_id}][%d] patchGuestDriveByIdBadRequest %+v", 400, o.Payload) +} + +func (o *PatchGuestDriveByIDBadRequest) 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 +} + +// NewPatchGuestDriveByIDDefault creates a PatchGuestDriveByIDDefault with default headers values +func NewPatchGuestDriveByIDDefault(code int) *PatchGuestDriveByIDDefault { + return &PatchGuestDriveByIDDefault{ + _statusCode: code, + } +} + +/*PatchGuestDriveByIDDefault handles this case with default header values. + +Internal server error. +*/ +type PatchGuestDriveByIDDefault struct { + _statusCode int + + Payload *models.Error +} + +// Code gets the status code for the patch guest drive by ID default response +func (o *PatchGuestDriveByIDDefault) Code() int { + return o._statusCode +} + +func (o *PatchGuestDriveByIDDefault) Error() string { + return fmt.Sprintf("[PATCH /drives/{drive_id}][%d] patchGuestDriveByID default %+v", o._statusCode, o.Payload) +} + +func (o *PatchGuestDriveByIDDefault) 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 +} diff --git a/virtcontainers/pkg/firecracker/client/operations/patch_guest_network_interface_by_id_parameters.go b/virtcontainers/pkg/firecracker/client/operations/patch_guest_network_interface_by_id_parameters.go new file mode 100644 index 0000000000..f1ff98b057 --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/operations/patch_guest_network_interface_by_id_parameters.go @@ -0,0 +1,160 @@ +// 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/runtime/virtcontainers/pkg/firecracker/client/models" +) + +// NewPatchGuestNetworkInterfaceByIDParams creates a new PatchGuestNetworkInterfaceByIDParams object +// with the default values initialized. +func NewPatchGuestNetworkInterfaceByIDParams() *PatchGuestNetworkInterfaceByIDParams { + var () + return &PatchGuestNetworkInterfaceByIDParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPatchGuestNetworkInterfaceByIDParamsWithTimeout creates a new PatchGuestNetworkInterfaceByIDParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPatchGuestNetworkInterfaceByIDParamsWithTimeout(timeout time.Duration) *PatchGuestNetworkInterfaceByIDParams { + var () + return &PatchGuestNetworkInterfaceByIDParams{ + + timeout: timeout, + } +} + +// NewPatchGuestNetworkInterfaceByIDParamsWithContext creates a new PatchGuestNetworkInterfaceByIDParams object +// with the default values initialized, and the ability to set a context for a request +func NewPatchGuestNetworkInterfaceByIDParamsWithContext(ctx context.Context) *PatchGuestNetworkInterfaceByIDParams { + var () + return &PatchGuestNetworkInterfaceByIDParams{ + + Context: ctx, + } +} + +// NewPatchGuestNetworkInterfaceByIDParamsWithHTTPClient creates a new PatchGuestNetworkInterfaceByIDParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPatchGuestNetworkInterfaceByIDParamsWithHTTPClient(client *http.Client) *PatchGuestNetworkInterfaceByIDParams { + var () + return &PatchGuestNetworkInterfaceByIDParams{ + HTTPClient: client, + } +} + +/*PatchGuestNetworkInterfaceByIDParams contains all the parameters to send to the API endpoint +for the patch guest network interface by ID operation typically these are written to a http.Request +*/ +type PatchGuestNetworkInterfaceByIDParams struct { + + /*Body + A subset of the guest network interface properties + + */ + Body *models.PartialNetworkInterface + /*IfaceID + The id of the guest network interface + + */ + IfaceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the patch guest network interface by ID params +func (o *PatchGuestNetworkInterfaceByIDParams) WithTimeout(timeout time.Duration) *PatchGuestNetworkInterfaceByIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch guest network interface by ID params +func (o *PatchGuestNetworkInterfaceByIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch guest network interface by ID params +func (o *PatchGuestNetworkInterfaceByIDParams) WithContext(ctx context.Context) *PatchGuestNetworkInterfaceByIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch guest network interface by ID params +func (o *PatchGuestNetworkInterfaceByIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch guest network interface by ID params +func (o *PatchGuestNetworkInterfaceByIDParams) WithHTTPClient(client *http.Client) *PatchGuestNetworkInterfaceByIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch guest network interface by ID params +func (o *PatchGuestNetworkInterfaceByIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the patch guest network interface by ID params +func (o *PatchGuestNetworkInterfaceByIDParams) WithBody(body *models.PartialNetworkInterface) *PatchGuestNetworkInterfaceByIDParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch guest network interface by ID params +func (o *PatchGuestNetworkInterfaceByIDParams) SetBody(body *models.PartialNetworkInterface) { + o.Body = body +} + +// WithIfaceID adds the ifaceID to the patch guest network interface by ID params +func (o *PatchGuestNetworkInterfaceByIDParams) WithIfaceID(ifaceID string) *PatchGuestNetworkInterfaceByIDParams { + o.SetIfaceID(ifaceID) + return o +} + +// SetIfaceID adds the ifaceId to the patch guest network interface by ID params +func (o *PatchGuestNetworkInterfaceByIDParams) SetIfaceID(ifaceID string) { + o.IfaceID = ifaceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchGuestNetworkInterfaceByIDParams) 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 + } + } + + // path param iface_id + if err := r.SetPathParam("iface_id", o.IfaceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/virtcontainers/pkg/firecracker/client/operations/patch_guest_network_interface_by_id_responses.go b/virtcontainers/pkg/firecracker/client/operations/patch_guest_network_interface_by_id_responses.go new file mode 100644 index 0000000000..cb9ed11b72 --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/operations/patch_guest_network_interface_by_id_responses.go @@ -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/runtime/virtcontainers/pkg/firecracker/client/models" +) + +// PatchGuestNetworkInterfaceByIDReader is a Reader for the PatchGuestNetworkInterfaceByID structure. +type PatchGuestNetworkInterfaceByIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchGuestNetworkInterfaceByIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 204: + result := NewPatchGuestNetworkInterfaceByIDNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 400: + result := NewPatchGuestNetworkInterfaceByIDBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + result := NewPatchGuestNetworkInterfaceByIDDefault(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 + } +} + +// NewPatchGuestNetworkInterfaceByIDNoContent creates a PatchGuestNetworkInterfaceByIDNoContent with default headers values +func NewPatchGuestNetworkInterfaceByIDNoContent() *PatchGuestNetworkInterfaceByIDNoContent { + return &PatchGuestNetworkInterfaceByIDNoContent{} +} + +/*PatchGuestNetworkInterfaceByIDNoContent handles this case with default header values. + +Network interface updated +*/ +type PatchGuestNetworkInterfaceByIDNoContent struct { +} + +func (o *PatchGuestNetworkInterfaceByIDNoContent) Error() string { + return fmt.Sprintf("[PATCH /network-interfaces/{iface_id}][%d] patchGuestNetworkInterfaceByIdNoContent ", 204) +} + +func (o *PatchGuestNetworkInterfaceByIDNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPatchGuestNetworkInterfaceByIDBadRequest creates a PatchGuestNetworkInterfaceByIDBadRequest with default headers values +func NewPatchGuestNetworkInterfaceByIDBadRequest() *PatchGuestNetworkInterfaceByIDBadRequest { + return &PatchGuestNetworkInterfaceByIDBadRequest{} +} + +/*PatchGuestNetworkInterfaceByIDBadRequest handles this case with default header values. + +Network interface cannot be updated due to bad input +*/ +type PatchGuestNetworkInterfaceByIDBadRequest struct { + Payload *models.Error +} + +func (o *PatchGuestNetworkInterfaceByIDBadRequest) Error() string { + return fmt.Sprintf("[PATCH /network-interfaces/{iface_id}][%d] patchGuestNetworkInterfaceByIdBadRequest %+v", 400, o.Payload) +} + +func (o *PatchGuestNetworkInterfaceByIDBadRequest) 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 +} + +// NewPatchGuestNetworkInterfaceByIDDefault creates a PatchGuestNetworkInterfaceByIDDefault with default headers values +func NewPatchGuestNetworkInterfaceByIDDefault(code int) *PatchGuestNetworkInterfaceByIDDefault { + return &PatchGuestNetworkInterfaceByIDDefault{ + _statusCode: code, + } +} + +/*PatchGuestNetworkInterfaceByIDDefault handles this case with default header values. + +Internal server error +*/ +type PatchGuestNetworkInterfaceByIDDefault struct { + _statusCode int + + Payload *models.Error +} + +// Code gets the status code for the patch guest network interface by ID default response +func (o *PatchGuestNetworkInterfaceByIDDefault) Code() int { + return o._statusCode +} + +func (o *PatchGuestNetworkInterfaceByIDDefault) Error() string { + return fmt.Sprintf("[PATCH /network-interfaces/{iface_id}][%d] patchGuestNetworkInterfaceByID default %+v", o._statusCode, o.Payload) +} + +func (o *PatchGuestNetworkInterfaceByIDDefault) 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 +} diff --git a/virtcontainers/pkg/firecracker/client/operations/patch_machine_configuration_parameters.go b/virtcontainers/pkg/firecracker/client/operations/patch_machine_configuration_parameters.go new file mode 100644 index 0000000000..579dfd1db8 --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/operations/patch_machine_configuration_parameters.go @@ -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/runtime/virtcontainers/pkg/firecracker/client/models" +) + +// NewPatchMachineConfigurationParams creates a new PatchMachineConfigurationParams object +// with the default values initialized. +func NewPatchMachineConfigurationParams() *PatchMachineConfigurationParams { + var () + return &PatchMachineConfigurationParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPatchMachineConfigurationParamsWithTimeout creates a new PatchMachineConfigurationParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPatchMachineConfigurationParamsWithTimeout(timeout time.Duration) *PatchMachineConfigurationParams { + var () + return &PatchMachineConfigurationParams{ + + timeout: timeout, + } +} + +// NewPatchMachineConfigurationParamsWithContext creates a new PatchMachineConfigurationParams object +// with the default values initialized, and the ability to set a context for a request +func NewPatchMachineConfigurationParamsWithContext(ctx context.Context) *PatchMachineConfigurationParams { + var () + return &PatchMachineConfigurationParams{ + + Context: ctx, + } +} + +// NewPatchMachineConfigurationParamsWithHTTPClient creates a new PatchMachineConfigurationParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPatchMachineConfigurationParamsWithHTTPClient(client *http.Client) *PatchMachineConfigurationParams { + var () + return &PatchMachineConfigurationParams{ + HTTPClient: client, + } +} + +/*PatchMachineConfigurationParams contains all the parameters to send to the API endpoint +for the patch machine configuration operation typically these are written to a http.Request +*/ +type PatchMachineConfigurationParams struct { + + /*Body + A subset of Machine Configuration Parameters + + */ + Body *models.MachineConfiguration + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the patch machine configuration params +func (o *PatchMachineConfigurationParams) WithTimeout(timeout time.Duration) *PatchMachineConfigurationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch machine configuration params +func (o *PatchMachineConfigurationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch machine configuration params +func (o *PatchMachineConfigurationParams) WithContext(ctx context.Context) *PatchMachineConfigurationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch machine configuration params +func (o *PatchMachineConfigurationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch machine configuration params +func (o *PatchMachineConfigurationParams) WithHTTPClient(client *http.Client) *PatchMachineConfigurationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch machine configuration params +func (o *PatchMachineConfigurationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the patch machine configuration params +func (o *PatchMachineConfigurationParams) WithBody(body *models.MachineConfiguration) *PatchMachineConfigurationParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch machine configuration params +func (o *PatchMachineConfigurationParams) SetBody(body *models.MachineConfiguration) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchMachineConfigurationParams) 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 +} diff --git a/virtcontainers/pkg/firecracker/client/operations/patch_machine_configuration_responses.go b/virtcontainers/pkg/firecracker/client/operations/patch_machine_configuration_responses.go new file mode 100644 index 0000000000..b796d056a7 --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/operations/patch_machine_configuration_responses.go @@ -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/runtime/virtcontainers/pkg/firecracker/client/models" +) + +// PatchMachineConfigurationReader is a Reader for the PatchMachineConfiguration structure. +type PatchMachineConfigurationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchMachineConfigurationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 204: + result := NewPatchMachineConfigurationNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 400: + result := NewPatchMachineConfigurationBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + result := NewPatchMachineConfigurationDefault(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 + } +} + +// NewPatchMachineConfigurationNoContent creates a PatchMachineConfigurationNoContent with default headers values +func NewPatchMachineConfigurationNoContent() *PatchMachineConfigurationNoContent { + return &PatchMachineConfigurationNoContent{} +} + +/*PatchMachineConfigurationNoContent handles this case with default header values. + +Machine Configuration created/updated +*/ +type PatchMachineConfigurationNoContent struct { +} + +func (o *PatchMachineConfigurationNoContent) Error() string { + return fmt.Sprintf("[PATCH /machine-config][%d] patchMachineConfigurationNoContent ", 204) +} + +func (o *PatchMachineConfigurationNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPatchMachineConfigurationBadRequest creates a PatchMachineConfigurationBadRequest with default headers values +func NewPatchMachineConfigurationBadRequest() *PatchMachineConfigurationBadRequest { + return &PatchMachineConfigurationBadRequest{} +} + +/*PatchMachineConfigurationBadRequest handles this case with default header values. + +Machine Configuration cannot be updated due to bad input +*/ +type PatchMachineConfigurationBadRequest struct { + Payload *models.Error +} + +func (o *PatchMachineConfigurationBadRequest) Error() string { + return fmt.Sprintf("[PATCH /machine-config][%d] patchMachineConfigurationBadRequest %+v", 400, o.Payload) +} + +func (o *PatchMachineConfigurationBadRequest) 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 +} + +// NewPatchMachineConfigurationDefault creates a PatchMachineConfigurationDefault with default headers values +func NewPatchMachineConfigurationDefault(code int) *PatchMachineConfigurationDefault { + return &PatchMachineConfigurationDefault{ + _statusCode: code, + } +} + +/*PatchMachineConfigurationDefault handles this case with default header values. + +Internal server error +*/ +type PatchMachineConfigurationDefault struct { + _statusCode int + + Payload *models.Error +} + +// Code gets the status code for the patch machine configuration default response +func (o *PatchMachineConfigurationDefault) Code() int { + return o._statusCode +} + +func (o *PatchMachineConfigurationDefault) Error() string { + return fmt.Sprintf("[PATCH /machine-config][%d] patchMachineConfiguration default %+v", o._statusCode, o.Payload) +} + +func (o *PatchMachineConfigurationDefault) 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 +} diff --git a/virtcontainers/pkg/firecracker/client/operations/patch_mmds_parameters.go b/virtcontainers/pkg/firecracker/client/operations/patch_mmds_parameters.go new file mode 100644 index 0000000000..6ed2a66464 --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/operations/patch_mmds_parameters.go @@ -0,0 +1,137 @@ +// 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" +) + +// NewPatchMmdsParams creates a new PatchMmdsParams object +// with the default values initialized. +func NewPatchMmdsParams() *PatchMmdsParams { + var () + return &PatchMmdsParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPatchMmdsParamsWithTimeout creates a new PatchMmdsParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPatchMmdsParamsWithTimeout(timeout time.Duration) *PatchMmdsParams { + var () + return &PatchMmdsParams{ + + timeout: timeout, + } +} + +// NewPatchMmdsParamsWithContext creates a new PatchMmdsParams object +// with the default values initialized, and the ability to set a context for a request +func NewPatchMmdsParamsWithContext(ctx context.Context) *PatchMmdsParams { + var () + return &PatchMmdsParams{ + + Context: ctx, + } +} + +// NewPatchMmdsParamsWithHTTPClient creates a new PatchMmdsParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPatchMmdsParamsWithHTTPClient(client *http.Client) *PatchMmdsParams { + var () + return &PatchMmdsParams{ + HTTPClient: client, + } +} + +/*PatchMmdsParams contains all the parameters to send to the API endpoint +for the patch mmds operation typically these are written to a http.Request +*/ +type PatchMmdsParams struct { + + /*Body + The MMDS data store patch JSON. + + */ + Body interface{} + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the patch mmds params +func (o *PatchMmdsParams) WithTimeout(timeout time.Duration) *PatchMmdsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch mmds params +func (o *PatchMmdsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch mmds params +func (o *PatchMmdsParams) WithContext(ctx context.Context) *PatchMmdsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch mmds params +func (o *PatchMmdsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch mmds params +func (o *PatchMmdsParams) WithHTTPClient(client *http.Client) *PatchMmdsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch mmds params +func (o *PatchMmdsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the patch mmds params +func (o *PatchMmdsParams) WithBody(body interface{}) *PatchMmdsParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch mmds params +func (o *PatchMmdsParams) SetBody(body interface{}) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchMmdsParams) 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 +} diff --git a/virtcontainers/pkg/firecracker/client/operations/patch_mmds_responses.go b/virtcontainers/pkg/firecracker/client/operations/patch_mmds_responses.go new file mode 100644 index 0000000000..113c5abaa6 --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/operations/patch_mmds_responses.go @@ -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/runtime/virtcontainers/pkg/firecracker/client/models" +) + +// PatchMmdsReader is a Reader for the PatchMmds structure. +type PatchMmdsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchMmdsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 204: + result := NewPatchMmdsNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 400: + result := NewPatchMmdsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + result := NewPatchMmdsDefault(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 + } +} + +// NewPatchMmdsNoContent creates a PatchMmdsNoContent with default headers values +func NewPatchMmdsNoContent() *PatchMmdsNoContent { + return &PatchMmdsNoContent{} +} + +/*PatchMmdsNoContent handles this case with default header values. + +MMDS data store updated. +*/ +type PatchMmdsNoContent struct { +} + +func (o *PatchMmdsNoContent) Error() string { + return fmt.Sprintf("[PATCH /mmds][%d] patchMmdsNoContent ", 204) +} + +func (o *PatchMmdsNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPatchMmdsBadRequest creates a PatchMmdsBadRequest with default headers values +func NewPatchMmdsBadRequest() *PatchMmdsBadRequest { + return &PatchMmdsBadRequest{} +} + +/*PatchMmdsBadRequest handles this case with default header values. + +MMDS data store cannot be updated due to bad input. +*/ +type PatchMmdsBadRequest struct { + Payload *models.Error +} + +func (o *PatchMmdsBadRequest) Error() string { + return fmt.Sprintf("[PATCH /mmds][%d] patchMmdsBadRequest %+v", 400, o.Payload) +} + +func (o *PatchMmdsBadRequest) 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 +} + +// NewPatchMmdsDefault creates a PatchMmdsDefault with default headers values +func NewPatchMmdsDefault(code int) *PatchMmdsDefault { + return &PatchMmdsDefault{ + _statusCode: code, + } +} + +/*PatchMmdsDefault handles this case with default header values. + +Internal server error +*/ +type PatchMmdsDefault struct { + _statusCode int + + Payload *models.Error +} + +// Code gets the status code for the patch mmds default response +func (o *PatchMmdsDefault) Code() int { + return o._statusCode +} + +func (o *PatchMmdsDefault) Error() string { + return fmt.Sprintf("[PATCH /mmds][%d] PatchMmds default %+v", o._statusCode, o.Payload) +} + +func (o *PatchMmdsDefault) 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 +} diff --git a/virtcontainers/pkg/firecracker/client/operations/put_guest_boot_source_parameters.go b/virtcontainers/pkg/firecracker/client/operations/put_guest_boot_source_parameters.go new file mode 100644 index 0000000000..23e1cb81ab --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/operations/put_guest_boot_source_parameters.go @@ -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/runtime/virtcontainers/pkg/firecracker/client/models" +) + +// NewPutGuestBootSourceParams creates a new PutGuestBootSourceParams object +// with the default values initialized. +func NewPutGuestBootSourceParams() *PutGuestBootSourceParams { + var () + return &PutGuestBootSourceParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPutGuestBootSourceParamsWithTimeout creates a new PutGuestBootSourceParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPutGuestBootSourceParamsWithTimeout(timeout time.Duration) *PutGuestBootSourceParams { + var () + return &PutGuestBootSourceParams{ + + timeout: timeout, + } +} + +// NewPutGuestBootSourceParamsWithContext creates a new PutGuestBootSourceParams object +// with the default values initialized, and the ability to set a context for a request +func NewPutGuestBootSourceParamsWithContext(ctx context.Context) *PutGuestBootSourceParams { + var () + return &PutGuestBootSourceParams{ + + Context: ctx, + } +} + +// NewPutGuestBootSourceParamsWithHTTPClient creates a new PutGuestBootSourceParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPutGuestBootSourceParamsWithHTTPClient(client *http.Client) *PutGuestBootSourceParams { + var () + return &PutGuestBootSourceParams{ + HTTPClient: client, + } +} + +/*PutGuestBootSourceParams contains all the parameters to send to the API endpoint +for the put guest boot source operation typically these are written to a http.Request +*/ +type PutGuestBootSourceParams struct { + + /*Body + Guest boot source properties + + */ + Body *models.BootSource + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the put guest boot source params +func (o *PutGuestBootSourceParams) WithTimeout(timeout time.Duration) *PutGuestBootSourceParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the put guest boot source params +func (o *PutGuestBootSourceParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the put guest boot source params +func (o *PutGuestBootSourceParams) WithContext(ctx context.Context) *PutGuestBootSourceParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the put guest boot source params +func (o *PutGuestBootSourceParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the put guest boot source params +func (o *PutGuestBootSourceParams) WithHTTPClient(client *http.Client) *PutGuestBootSourceParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the put guest boot source params +func (o *PutGuestBootSourceParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the put guest boot source params +func (o *PutGuestBootSourceParams) WithBody(body *models.BootSource) *PutGuestBootSourceParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the put guest boot source params +func (o *PutGuestBootSourceParams) SetBody(body *models.BootSource) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PutGuestBootSourceParams) 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 +} diff --git a/virtcontainers/pkg/firecracker/client/operations/put_guest_boot_source_responses.go b/virtcontainers/pkg/firecracker/client/operations/put_guest_boot_source_responses.go new file mode 100644 index 0000000000..3d39bebe87 --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/operations/put_guest_boot_source_responses.go @@ -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/runtime/virtcontainers/pkg/firecracker/client/models" +) + +// PutGuestBootSourceReader is a Reader for the PutGuestBootSource structure. +type PutGuestBootSourceReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PutGuestBootSourceReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 204: + result := NewPutGuestBootSourceNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 400: + result := NewPutGuestBootSourceBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + result := NewPutGuestBootSourceDefault(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 + } +} + +// NewPutGuestBootSourceNoContent creates a PutGuestBootSourceNoContent with default headers values +func NewPutGuestBootSourceNoContent() *PutGuestBootSourceNoContent { + return &PutGuestBootSourceNoContent{} +} + +/*PutGuestBootSourceNoContent handles this case with default header values. + +Boot source created/updated +*/ +type PutGuestBootSourceNoContent struct { +} + +func (o *PutGuestBootSourceNoContent) Error() string { + return fmt.Sprintf("[PUT /boot-source][%d] putGuestBootSourceNoContent ", 204) +} + +func (o *PutGuestBootSourceNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPutGuestBootSourceBadRequest creates a PutGuestBootSourceBadRequest with default headers values +func NewPutGuestBootSourceBadRequest() *PutGuestBootSourceBadRequest { + return &PutGuestBootSourceBadRequest{} +} + +/*PutGuestBootSourceBadRequest handles this case with default header values. + +Boot source cannot be created due to bad input +*/ +type PutGuestBootSourceBadRequest struct { + Payload *models.Error +} + +func (o *PutGuestBootSourceBadRequest) Error() string { + return fmt.Sprintf("[PUT /boot-source][%d] putGuestBootSourceBadRequest %+v", 400, o.Payload) +} + +func (o *PutGuestBootSourceBadRequest) 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 +} + +// NewPutGuestBootSourceDefault creates a PutGuestBootSourceDefault with default headers values +func NewPutGuestBootSourceDefault(code int) *PutGuestBootSourceDefault { + return &PutGuestBootSourceDefault{ + _statusCode: code, + } +} + +/*PutGuestBootSourceDefault handles this case with default header values. + +Internal server error +*/ +type PutGuestBootSourceDefault struct { + _statusCode int + + Payload *models.Error +} + +// Code gets the status code for the put guest boot source default response +func (o *PutGuestBootSourceDefault) Code() int { + return o._statusCode +} + +func (o *PutGuestBootSourceDefault) Error() string { + return fmt.Sprintf("[PUT /boot-source][%d] putGuestBootSource default %+v", o._statusCode, o.Payload) +} + +func (o *PutGuestBootSourceDefault) 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 +} diff --git a/virtcontainers/pkg/firecracker/client/operations/put_guest_drive_by_id_parameters.go b/virtcontainers/pkg/firecracker/client/operations/put_guest_drive_by_id_parameters.go new file mode 100644 index 0000000000..d261a76815 --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/operations/put_guest_drive_by_id_parameters.go @@ -0,0 +1,160 @@ +// 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/runtime/virtcontainers/pkg/firecracker/client/models" +) + +// NewPutGuestDriveByIDParams creates a new PutGuestDriveByIDParams object +// with the default values initialized. +func NewPutGuestDriveByIDParams() *PutGuestDriveByIDParams { + var () + return &PutGuestDriveByIDParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPutGuestDriveByIDParamsWithTimeout creates a new PutGuestDriveByIDParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPutGuestDriveByIDParamsWithTimeout(timeout time.Duration) *PutGuestDriveByIDParams { + var () + return &PutGuestDriveByIDParams{ + + timeout: timeout, + } +} + +// NewPutGuestDriveByIDParamsWithContext creates a new PutGuestDriveByIDParams object +// with the default values initialized, and the ability to set a context for a request +func NewPutGuestDriveByIDParamsWithContext(ctx context.Context) *PutGuestDriveByIDParams { + var () + return &PutGuestDriveByIDParams{ + + Context: ctx, + } +} + +// NewPutGuestDriveByIDParamsWithHTTPClient creates a new PutGuestDriveByIDParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPutGuestDriveByIDParamsWithHTTPClient(client *http.Client) *PutGuestDriveByIDParams { + var () + return &PutGuestDriveByIDParams{ + HTTPClient: client, + } +} + +/*PutGuestDriveByIDParams contains all the parameters to send to the API endpoint +for the put guest drive by ID operation typically these are written to a http.Request +*/ +type PutGuestDriveByIDParams struct { + + /*Body + Guest drive properties + + */ + Body *models.Drive + /*DriveID + The id of the guest drive + + */ + DriveID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the put guest drive by ID params +func (o *PutGuestDriveByIDParams) WithTimeout(timeout time.Duration) *PutGuestDriveByIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the put guest drive by ID params +func (o *PutGuestDriveByIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the put guest drive by ID params +func (o *PutGuestDriveByIDParams) WithContext(ctx context.Context) *PutGuestDriveByIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the put guest drive by ID params +func (o *PutGuestDriveByIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the put guest drive by ID params +func (o *PutGuestDriveByIDParams) WithHTTPClient(client *http.Client) *PutGuestDriveByIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the put guest drive by ID params +func (o *PutGuestDriveByIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the put guest drive by ID params +func (o *PutGuestDriveByIDParams) WithBody(body *models.Drive) *PutGuestDriveByIDParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the put guest drive by ID params +func (o *PutGuestDriveByIDParams) SetBody(body *models.Drive) { + o.Body = body +} + +// WithDriveID adds the driveID to the put guest drive by ID params +func (o *PutGuestDriveByIDParams) WithDriveID(driveID string) *PutGuestDriveByIDParams { + o.SetDriveID(driveID) + return o +} + +// SetDriveID adds the driveId to the put guest drive by ID params +func (o *PutGuestDriveByIDParams) SetDriveID(driveID string) { + o.DriveID = driveID +} + +// WriteToRequest writes these params to a swagger request +func (o *PutGuestDriveByIDParams) 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 + } + } + + // path param drive_id + if err := r.SetPathParam("drive_id", o.DriveID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/virtcontainers/pkg/firecracker/client/operations/put_guest_drive_by_id_responses.go b/virtcontainers/pkg/firecracker/client/operations/put_guest_drive_by_id_responses.go new file mode 100644 index 0000000000..6dc8d6419f --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/operations/put_guest_drive_by_id_responses.go @@ -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/runtime/virtcontainers/pkg/firecracker/client/models" +) + +// PutGuestDriveByIDReader is a Reader for the PutGuestDriveByID structure. +type PutGuestDriveByIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PutGuestDriveByIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 204: + result := NewPutGuestDriveByIDNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 400: + result := NewPutGuestDriveByIDBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + result := NewPutGuestDriveByIDDefault(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 + } +} + +// NewPutGuestDriveByIDNoContent creates a PutGuestDriveByIDNoContent with default headers values +func NewPutGuestDriveByIDNoContent() *PutGuestDriveByIDNoContent { + return &PutGuestDriveByIDNoContent{} +} + +/*PutGuestDriveByIDNoContent handles this case with default header values. + +Drive created/updated +*/ +type PutGuestDriveByIDNoContent struct { +} + +func (o *PutGuestDriveByIDNoContent) Error() string { + return fmt.Sprintf("[PUT /drives/{drive_id}][%d] putGuestDriveByIdNoContent ", 204) +} + +func (o *PutGuestDriveByIDNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPutGuestDriveByIDBadRequest creates a PutGuestDriveByIDBadRequest with default headers values +func NewPutGuestDriveByIDBadRequest() *PutGuestDriveByIDBadRequest { + return &PutGuestDriveByIDBadRequest{} +} + +/*PutGuestDriveByIDBadRequest handles this case with default header values. + +Drive cannot be created/updated due to bad input +*/ +type PutGuestDriveByIDBadRequest struct { + Payload *models.Error +} + +func (o *PutGuestDriveByIDBadRequest) Error() string { + return fmt.Sprintf("[PUT /drives/{drive_id}][%d] putGuestDriveByIdBadRequest %+v", 400, o.Payload) +} + +func (o *PutGuestDriveByIDBadRequest) 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 +} + +// NewPutGuestDriveByIDDefault creates a PutGuestDriveByIDDefault with default headers values +func NewPutGuestDriveByIDDefault(code int) *PutGuestDriveByIDDefault { + return &PutGuestDriveByIDDefault{ + _statusCode: code, + } +} + +/*PutGuestDriveByIDDefault handles this case with default header values. + +Internal server error. +*/ +type PutGuestDriveByIDDefault struct { + _statusCode int + + Payload *models.Error +} + +// Code gets the status code for the put guest drive by ID default response +func (o *PutGuestDriveByIDDefault) Code() int { + return o._statusCode +} + +func (o *PutGuestDriveByIDDefault) Error() string { + return fmt.Sprintf("[PUT /drives/{drive_id}][%d] putGuestDriveByID default %+v", o._statusCode, o.Payload) +} + +func (o *PutGuestDriveByIDDefault) 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 +} diff --git a/virtcontainers/pkg/firecracker/client/operations/put_guest_network_interface_by_id_parameters.go b/virtcontainers/pkg/firecracker/client/operations/put_guest_network_interface_by_id_parameters.go new file mode 100644 index 0000000000..4f30525126 --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/operations/put_guest_network_interface_by_id_parameters.go @@ -0,0 +1,160 @@ +// 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/runtime/virtcontainers/pkg/firecracker/client/models" +) + +// NewPutGuestNetworkInterfaceByIDParams creates a new PutGuestNetworkInterfaceByIDParams object +// with the default values initialized. +func NewPutGuestNetworkInterfaceByIDParams() *PutGuestNetworkInterfaceByIDParams { + var () + return &PutGuestNetworkInterfaceByIDParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPutGuestNetworkInterfaceByIDParamsWithTimeout creates a new PutGuestNetworkInterfaceByIDParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPutGuestNetworkInterfaceByIDParamsWithTimeout(timeout time.Duration) *PutGuestNetworkInterfaceByIDParams { + var () + return &PutGuestNetworkInterfaceByIDParams{ + + timeout: timeout, + } +} + +// NewPutGuestNetworkInterfaceByIDParamsWithContext creates a new PutGuestNetworkInterfaceByIDParams object +// with the default values initialized, and the ability to set a context for a request +func NewPutGuestNetworkInterfaceByIDParamsWithContext(ctx context.Context) *PutGuestNetworkInterfaceByIDParams { + var () + return &PutGuestNetworkInterfaceByIDParams{ + + Context: ctx, + } +} + +// NewPutGuestNetworkInterfaceByIDParamsWithHTTPClient creates a new PutGuestNetworkInterfaceByIDParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPutGuestNetworkInterfaceByIDParamsWithHTTPClient(client *http.Client) *PutGuestNetworkInterfaceByIDParams { + var () + return &PutGuestNetworkInterfaceByIDParams{ + HTTPClient: client, + } +} + +/*PutGuestNetworkInterfaceByIDParams contains all the parameters to send to the API endpoint +for the put guest network interface by ID operation typically these are written to a http.Request +*/ +type PutGuestNetworkInterfaceByIDParams struct { + + /*Body + Guest network interface properties + + */ + Body *models.NetworkInterface + /*IfaceID + The id of the guest network interface + + */ + IfaceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the put guest network interface by ID params +func (o *PutGuestNetworkInterfaceByIDParams) WithTimeout(timeout time.Duration) *PutGuestNetworkInterfaceByIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the put guest network interface by ID params +func (o *PutGuestNetworkInterfaceByIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the put guest network interface by ID params +func (o *PutGuestNetworkInterfaceByIDParams) WithContext(ctx context.Context) *PutGuestNetworkInterfaceByIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the put guest network interface by ID params +func (o *PutGuestNetworkInterfaceByIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the put guest network interface by ID params +func (o *PutGuestNetworkInterfaceByIDParams) WithHTTPClient(client *http.Client) *PutGuestNetworkInterfaceByIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the put guest network interface by ID params +func (o *PutGuestNetworkInterfaceByIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the put guest network interface by ID params +func (o *PutGuestNetworkInterfaceByIDParams) WithBody(body *models.NetworkInterface) *PutGuestNetworkInterfaceByIDParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the put guest network interface by ID params +func (o *PutGuestNetworkInterfaceByIDParams) SetBody(body *models.NetworkInterface) { + o.Body = body +} + +// WithIfaceID adds the ifaceID to the put guest network interface by ID params +func (o *PutGuestNetworkInterfaceByIDParams) WithIfaceID(ifaceID string) *PutGuestNetworkInterfaceByIDParams { + o.SetIfaceID(ifaceID) + return o +} + +// SetIfaceID adds the ifaceId to the put guest network interface by ID params +func (o *PutGuestNetworkInterfaceByIDParams) SetIfaceID(ifaceID string) { + o.IfaceID = ifaceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PutGuestNetworkInterfaceByIDParams) 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 + } + } + + // path param iface_id + if err := r.SetPathParam("iface_id", o.IfaceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/virtcontainers/pkg/firecracker/client/operations/put_guest_network_interface_by_id_responses.go b/virtcontainers/pkg/firecracker/client/operations/put_guest_network_interface_by_id_responses.go new file mode 100644 index 0000000000..ebfbe2d604 --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/operations/put_guest_network_interface_by_id_responses.go @@ -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/runtime/virtcontainers/pkg/firecracker/client/models" +) + +// PutGuestNetworkInterfaceByIDReader is a Reader for the PutGuestNetworkInterfaceByID structure. +type PutGuestNetworkInterfaceByIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PutGuestNetworkInterfaceByIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 204: + result := NewPutGuestNetworkInterfaceByIDNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 400: + result := NewPutGuestNetworkInterfaceByIDBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + result := NewPutGuestNetworkInterfaceByIDDefault(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 + } +} + +// NewPutGuestNetworkInterfaceByIDNoContent creates a PutGuestNetworkInterfaceByIDNoContent with default headers values +func NewPutGuestNetworkInterfaceByIDNoContent() *PutGuestNetworkInterfaceByIDNoContent { + return &PutGuestNetworkInterfaceByIDNoContent{} +} + +/*PutGuestNetworkInterfaceByIDNoContent handles this case with default header values. + +Network interface created/updated +*/ +type PutGuestNetworkInterfaceByIDNoContent struct { +} + +func (o *PutGuestNetworkInterfaceByIDNoContent) Error() string { + return fmt.Sprintf("[PUT /network-interfaces/{iface_id}][%d] putGuestNetworkInterfaceByIdNoContent ", 204) +} + +func (o *PutGuestNetworkInterfaceByIDNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPutGuestNetworkInterfaceByIDBadRequest creates a PutGuestNetworkInterfaceByIDBadRequest with default headers values +func NewPutGuestNetworkInterfaceByIDBadRequest() *PutGuestNetworkInterfaceByIDBadRequest { + return &PutGuestNetworkInterfaceByIDBadRequest{} +} + +/*PutGuestNetworkInterfaceByIDBadRequest handles this case with default header values. + +Network interface cannot be created due to bad input +*/ +type PutGuestNetworkInterfaceByIDBadRequest struct { + Payload *models.Error +} + +func (o *PutGuestNetworkInterfaceByIDBadRequest) Error() string { + return fmt.Sprintf("[PUT /network-interfaces/{iface_id}][%d] putGuestNetworkInterfaceByIdBadRequest %+v", 400, o.Payload) +} + +func (o *PutGuestNetworkInterfaceByIDBadRequest) 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 +} + +// NewPutGuestNetworkInterfaceByIDDefault creates a PutGuestNetworkInterfaceByIDDefault with default headers values +func NewPutGuestNetworkInterfaceByIDDefault(code int) *PutGuestNetworkInterfaceByIDDefault { + return &PutGuestNetworkInterfaceByIDDefault{ + _statusCode: code, + } +} + +/*PutGuestNetworkInterfaceByIDDefault handles this case with default header values. + +Internal server error +*/ +type PutGuestNetworkInterfaceByIDDefault struct { + _statusCode int + + Payload *models.Error +} + +// Code gets the status code for the put guest network interface by ID default response +func (o *PutGuestNetworkInterfaceByIDDefault) Code() int { + return o._statusCode +} + +func (o *PutGuestNetworkInterfaceByIDDefault) Error() string { + return fmt.Sprintf("[PUT /network-interfaces/{iface_id}][%d] putGuestNetworkInterfaceByID default %+v", o._statusCode, o.Payload) +} + +func (o *PutGuestNetworkInterfaceByIDDefault) 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 +} diff --git a/virtcontainers/pkg/firecracker/client/operations/put_guest_vsock_by_id_parameters.go b/virtcontainers/pkg/firecracker/client/operations/put_guest_vsock_by_id_parameters.go new file mode 100644 index 0000000000..29a85e2702 --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/operations/put_guest_vsock_by_id_parameters.go @@ -0,0 +1,160 @@ +// 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/runtime/virtcontainers/pkg/firecracker/client/models" +) + +// NewPutGuestVsockByIDParams creates a new PutGuestVsockByIDParams object +// with the default values initialized. +func NewPutGuestVsockByIDParams() *PutGuestVsockByIDParams { + var () + return &PutGuestVsockByIDParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPutGuestVsockByIDParamsWithTimeout creates a new PutGuestVsockByIDParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPutGuestVsockByIDParamsWithTimeout(timeout time.Duration) *PutGuestVsockByIDParams { + var () + return &PutGuestVsockByIDParams{ + + timeout: timeout, + } +} + +// NewPutGuestVsockByIDParamsWithContext creates a new PutGuestVsockByIDParams object +// with the default values initialized, and the ability to set a context for a request +func NewPutGuestVsockByIDParamsWithContext(ctx context.Context) *PutGuestVsockByIDParams { + var () + return &PutGuestVsockByIDParams{ + + Context: ctx, + } +} + +// NewPutGuestVsockByIDParamsWithHTTPClient creates a new PutGuestVsockByIDParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPutGuestVsockByIDParamsWithHTTPClient(client *http.Client) *PutGuestVsockByIDParams { + var () + return &PutGuestVsockByIDParams{ + HTTPClient: client, + } +} + +/*PutGuestVsockByIDParams contains all the parameters to send to the API endpoint +for the put guest vsock by ID operation typically these are written to a http.Request +*/ +type PutGuestVsockByIDParams struct { + + /*Body + Guest vsock properties + + */ + Body *models.Vsock + /*ID + The id of the vsock device + + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the put guest vsock by ID params +func (o *PutGuestVsockByIDParams) WithTimeout(timeout time.Duration) *PutGuestVsockByIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the put guest vsock by ID params +func (o *PutGuestVsockByIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the put guest vsock by ID params +func (o *PutGuestVsockByIDParams) WithContext(ctx context.Context) *PutGuestVsockByIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the put guest vsock by ID params +func (o *PutGuestVsockByIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the put guest vsock by ID params +func (o *PutGuestVsockByIDParams) WithHTTPClient(client *http.Client) *PutGuestVsockByIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the put guest vsock by ID params +func (o *PutGuestVsockByIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the put guest vsock by ID params +func (o *PutGuestVsockByIDParams) WithBody(body *models.Vsock) *PutGuestVsockByIDParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the put guest vsock by ID params +func (o *PutGuestVsockByIDParams) SetBody(body *models.Vsock) { + o.Body = body +} + +// WithID adds the id to the put guest vsock by ID params +func (o *PutGuestVsockByIDParams) WithID(id string) *PutGuestVsockByIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the put guest vsock by ID params +func (o *PutGuestVsockByIDParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PutGuestVsockByIDParams) 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 + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/virtcontainers/pkg/firecracker/client/operations/put_guest_vsock_by_id_responses.go b/virtcontainers/pkg/firecracker/client/operations/put_guest_vsock_by_id_responses.go new file mode 100644 index 0000000000..c9f78ca9d6 --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/operations/put_guest_vsock_by_id_responses.go @@ -0,0 +1,168 @@ +// 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/runtime/virtcontainers/pkg/firecracker/client/models" +) + +// PutGuestVsockByIDReader is a Reader for the PutGuestVsockByID structure. +type PutGuestVsockByIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PutGuestVsockByIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 201: + result := NewPutGuestVsockByIDCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 204: + result := NewPutGuestVsockByIDNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 400: + result := NewPutGuestVsockByIDBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + result := NewPutGuestVsockByIDDefault(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 + } +} + +// NewPutGuestVsockByIDCreated creates a PutGuestVsockByIDCreated with default headers values +func NewPutGuestVsockByIDCreated() *PutGuestVsockByIDCreated { + return &PutGuestVsockByIDCreated{} +} + +/*PutGuestVsockByIDCreated handles this case with default header values. + +Vsock created +*/ +type PutGuestVsockByIDCreated struct { +} + +func (o *PutGuestVsockByIDCreated) Error() string { + return fmt.Sprintf("[PUT /vsocks/{id}][%d] putGuestVsockByIdCreated ", 201) +} + +func (o *PutGuestVsockByIDCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPutGuestVsockByIDNoContent creates a PutGuestVsockByIDNoContent with default headers values +func NewPutGuestVsockByIDNoContent() *PutGuestVsockByIDNoContent { + return &PutGuestVsockByIDNoContent{} +} + +/*PutGuestVsockByIDNoContent handles this case with default header values. + +Vsock updated +*/ +type PutGuestVsockByIDNoContent struct { +} + +func (o *PutGuestVsockByIDNoContent) Error() string { + return fmt.Sprintf("[PUT /vsocks/{id}][%d] putGuestVsockByIdNoContent ", 204) +} + +func (o *PutGuestVsockByIDNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPutGuestVsockByIDBadRequest creates a PutGuestVsockByIDBadRequest with default headers values +func NewPutGuestVsockByIDBadRequest() *PutGuestVsockByIDBadRequest { + return &PutGuestVsockByIDBadRequest{} +} + +/*PutGuestVsockByIDBadRequest handles this case with default header values. + +Vsock cannot be created due to bad input +*/ +type PutGuestVsockByIDBadRequest struct { + Payload *models.Error +} + +func (o *PutGuestVsockByIDBadRequest) Error() string { + return fmt.Sprintf("[PUT /vsocks/{id}][%d] putGuestVsockByIdBadRequest %+v", 400, o.Payload) +} + +func (o *PutGuestVsockByIDBadRequest) 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 +} + +// NewPutGuestVsockByIDDefault creates a PutGuestVsockByIDDefault with default headers values +func NewPutGuestVsockByIDDefault(code int) *PutGuestVsockByIDDefault { + return &PutGuestVsockByIDDefault{ + _statusCode: code, + } +} + +/*PutGuestVsockByIDDefault handles this case with default header values. + +Internal server error +*/ +type PutGuestVsockByIDDefault struct { + _statusCode int + + Payload *models.Error +} + +// Code gets the status code for the put guest vsock by ID default response +func (o *PutGuestVsockByIDDefault) Code() int { + return o._statusCode +} + +func (o *PutGuestVsockByIDDefault) Error() string { + return fmt.Sprintf("[PUT /vsocks/{id}][%d] putGuestVsockByID default %+v", o._statusCode, o.Payload) +} + +func (o *PutGuestVsockByIDDefault) 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 +} diff --git a/virtcontainers/pkg/firecracker/client/operations/put_logger_parameters.go b/virtcontainers/pkg/firecracker/client/operations/put_logger_parameters.go new file mode 100644 index 0000000000..6960636a82 --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/operations/put_logger_parameters.go @@ -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/runtime/virtcontainers/pkg/firecracker/client/models" +) + +// NewPutLoggerParams creates a new PutLoggerParams object +// with the default values initialized. +func NewPutLoggerParams() *PutLoggerParams { + var () + return &PutLoggerParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPutLoggerParamsWithTimeout creates a new PutLoggerParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPutLoggerParamsWithTimeout(timeout time.Duration) *PutLoggerParams { + var () + return &PutLoggerParams{ + + timeout: timeout, + } +} + +// NewPutLoggerParamsWithContext creates a new PutLoggerParams object +// with the default values initialized, and the ability to set a context for a request +func NewPutLoggerParamsWithContext(ctx context.Context) *PutLoggerParams { + var () + return &PutLoggerParams{ + + Context: ctx, + } +} + +// NewPutLoggerParamsWithHTTPClient creates a new PutLoggerParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPutLoggerParamsWithHTTPClient(client *http.Client) *PutLoggerParams { + var () + return &PutLoggerParams{ + HTTPClient: client, + } +} + +/*PutLoggerParams contains all the parameters to send to the API endpoint +for the put logger operation typically these are written to a http.Request +*/ +type PutLoggerParams struct { + + /*Body + Logging system description + + */ + Body *models.Logger + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the put logger params +func (o *PutLoggerParams) WithTimeout(timeout time.Duration) *PutLoggerParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the put logger params +func (o *PutLoggerParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the put logger params +func (o *PutLoggerParams) WithContext(ctx context.Context) *PutLoggerParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the put logger params +func (o *PutLoggerParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the put logger params +func (o *PutLoggerParams) WithHTTPClient(client *http.Client) *PutLoggerParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the put logger params +func (o *PutLoggerParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the put logger params +func (o *PutLoggerParams) WithBody(body *models.Logger) *PutLoggerParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the put logger params +func (o *PutLoggerParams) SetBody(body *models.Logger) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PutLoggerParams) 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 +} diff --git a/virtcontainers/pkg/firecracker/client/operations/put_logger_responses.go b/virtcontainers/pkg/firecracker/client/operations/put_logger_responses.go new file mode 100644 index 0000000000..c986768786 --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/operations/put_logger_responses.go @@ -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/runtime/virtcontainers/pkg/firecracker/client/models" +) + +// PutLoggerReader is a Reader for the PutLogger structure. +type PutLoggerReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PutLoggerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 204: + result := NewPutLoggerNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 400: + result := NewPutLoggerBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + result := NewPutLoggerDefault(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 + } +} + +// NewPutLoggerNoContent creates a PutLoggerNoContent with default headers values +func NewPutLoggerNoContent() *PutLoggerNoContent { + return &PutLoggerNoContent{} +} + +/*PutLoggerNoContent handles this case with default header values. + +Logger created. +*/ +type PutLoggerNoContent struct { +} + +func (o *PutLoggerNoContent) Error() string { + return fmt.Sprintf("[PUT /logger][%d] putLoggerNoContent ", 204) +} + +func (o *PutLoggerNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPutLoggerBadRequest creates a PutLoggerBadRequest with default headers values +func NewPutLoggerBadRequest() *PutLoggerBadRequest { + return &PutLoggerBadRequest{} +} + +/*PutLoggerBadRequest handles this case with default header values. + +Logger cannot be initialized due to bad input. +*/ +type PutLoggerBadRequest struct { + Payload *models.Error +} + +func (o *PutLoggerBadRequest) Error() string { + return fmt.Sprintf("[PUT /logger][%d] putLoggerBadRequest %+v", 400, o.Payload) +} + +func (o *PutLoggerBadRequest) 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 +} + +// NewPutLoggerDefault creates a PutLoggerDefault with default headers values +func NewPutLoggerDefault(code int) *PutLoggerDefault { + return &PutLoggerDefault{ + _statusCode: code, + } +} + +/*PutLoggerDefault handles this case with default header values. + +Internal server error. +*/ +type PutLoggerDefault struct { + _statusCode int + + Payload *models.Error +} + +// Code gets the status code for the put logger default response +func (o *PutLoggerDefault) Code() int { + return o._statusCode +} + +func (o *PutLoggerDefault) Error() string { + return fmt.Sprintf("[PUT /logger][%d] putLogger default %+v", o._statusCode, o.Payload) +} + +func (o *PutLoggerDefault) 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 +} diff --git a/virtcontainers/pkg/firecracker/client/operations/put_machine_configuration_parameters.go b/virtcontainers/pkg/firecracker/client/operations/put_machine_configuration_parameters.go new file mode 100644 index 0000000000..7804d0c044 --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/operations/put_machine_configuration_parameters.go @@ -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/runtime/virtcontainers/pkg/firecracker/client/models" +) + +// NewPutMachineConfigurationParams creates a new PutMachineConfigurationParams object +// with the default values initialized. +func NewPutMachineConfigurationParams() *PutMachineConfigurationParams { + var () + return &PutMachineConfigurationParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPutMachineConfigurationParamsWithTimeout creates a new PutMachineConfigurationParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPutMachineConfigurationParamsWithTimeout(timeout time.Duration) *PutMachineConfigurationParams { + var () + return &PutMachineConfigurationParams{ + + timeout: timeout, + } +} + +// NewPutMachineConfigurationParamsWithContext creates a new PutMachineConfigurationParams object +// with the default values initialized, and the ability to set a context for a request +func NewPutMachineConfigurationParamsWithContext(ctx context.Context) *PutMachineConfigurationParams { + var () + return &PutMachineConfigurationParams{ + + Context: ctx, + } +} + +// NewPutMachineConfigurationParamsWithHTTPClient creates a new PutMachineConfigurationParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPutMachineConfigurationParamsWithHTTPClient(client *http.Client) *PutMachineConfigurationParams { + var () + return &PutMachineConfigurationParams{ + HTTPClient: client, + } +} + +/*PutMachineConfigurationParams contains all the parameters to send to the API endpoint +for the put machine configuration operation typically these are written to a http.Request +*/ +type PutMachineConfigurationParams struct { + + /*Body + Machine Configuration Parameters + + */ + Body *models.MachineConfiguration + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the put machine configuration params +func (o *PutMachineConfigurationParams) WithTimeout(timeout time.Duration) *PutMachineConfigurationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the put machine configuration params +func (o *PutMachineConfigurationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the put machine configuration params +func (o *PutMachineConfigurationParams) WithContext(ctx context.Context) *PutMachineConfigurationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the put machine configuration params +func (o *PutMachineConfigurationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the put machine configuration params +func (o *PutMachineConfigurationParams) WithHTTPClient(client *http.Client) *PutMachineConfigurationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the put machine configuration params +func (o *PutMachineConfigurationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the put machine configuration params +func (o *PutMachineConfigurationParams) WithBody(body *models.MachineConfiguration) *PutMachineConfigurationParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the put machine configuration params +func (o *PutMachineConfigurationParams) SetBody(body *models.MachineConfiguration) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PutMachineConfigurationParams) 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 +} diff --git a/virtcontainers/pkg/firecracker/client/operations/put_machine_configuration_responses.go b/virtcontainers/pkg/firecracker/client/operations/put_machine_configuration_responses.go new file mode 100644 index 0000000000..6127fea6e3 --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/operations/put_machine_configuration_responses.go @@ -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/runtime/virtcontainers/pkg/firecracker/client/models" +) + +// PutMachineConfigurationReader is a Reader for the PutMachineConfiguration structure. +type PutMachineConfigurationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PutMachineConfigurationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 204: + result := NewPutMachineConfigurationNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 400: + result := NewPutMachineConfigurationBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + result := NewPutMachineConfigurationDefault(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 + } +} + +// NewPutMachineConfigurationNoContent creates a PutMachineConfigurationNoContent with default headers values +func NewPutMachineConfigurationNoContent() *PutMachineConfigurationNoContent { + return &PutMachineConfigurationNoContent{} +} + +/*PutMachineConfigurationNoContent handles this case with default header values. + +Machine Configuration created/updated +*/ +type PutMachineConfigurationNoContent struct { +} + +func (o *PutMachineConfigurationNoContent) Error() string { + return fmt.Sprintf("[PUT /machine-config][%d] putMachineConfigurationNoContent ", 204) +} + +func (o *PutMachineConfigurationNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPutMachineConfigurationBadRequest creates a PutMachineConfigurationBadRequest with default headers values +func NewPutMachineConfigurationBadRequest() *PutMachineConfigurationBadRequest { + return &PutMachineConfigurationBadRequest{} +} + +/*PutMachineConfigurationBadRequest handles this case with default header values. + +Machine Configuration cannot be updated due to bad input +*/ +type PutMachineConfigurationBadRequest struct { + Payload *models.Error +} + +func (o *PutMachineConfigurationBadRequest) Error() string { + return fmt.Sprintf("[PUT /machine-config][%d] putMachineConfigurationBadRequest %+v", 400, o.Payload) +} + +func (o *PutMachineConfigurationBadRequest) 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 +} + +// NewPutMachineConfigurationDefault creates a PutMachineConfigurationDefault with default headers values +func NewPutMachineConfigurationDefault(code int) *PutMachineConfigurationDefault { + return &PutMachineConfigurationDefault{ + _statusCode: code, + } +} + +/*PutMachineConfigurationDefault handles this case with default header values. + +Internal server error +*/ +type PutMachineConfigurationDefault struct { + _statusCode int + + Payload *models.Error +} + +// Code gets the status code for the put machine configuration default response +func (o *PutMachineConfigurationDefault) Code() int { + return o._statusCode +} + +func (o *PutMachineConfigurationDefault) Error() string { + return fmt.Sprintf("[PUT /machine-config][%d] putMachineConfiguration default %+v", o._statusCode, o.Payload) +} + +func (o *PutMachineConfigurationDefault) 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 +} diff --git a/virtcontainers/pkg/firecracker/client/operations/put_mmds_parameters.go b/virtcontainers/pkg/firecracker/client/operations/put_mmds_parameters.go new file mode 100644 index 0000000000..106c8eb8af --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/operations/put_mmds_parameters.go @@ -0,0 +1,137 @@ +// 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" +) + +// NewPutMmdsParams creates a new PutMmdsParams object +// with the default values initialized. +func NewPutMmdsParams() *PutMmdsParams { + var () + return &PutMmdsParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPutMmdsParamsWithTimeout creates a new PutMmdsParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPutMmdsParamsWithTimeout(timeout time.Duration) *PutMmdsParams { + var () + return &PutMmdsParams{ + + timeout: timeout, + } +} + +// NewPutMmdsParamsWithContext creates a new PutMmdsParams object +// with the default values initialized, and the ability to set a context for a request +func NewPutMmdsParamsWithContext(ctx context.Context) *PutMmdsParams { + var () + return &PutMmdsParams{ + + Context: ctx, + } +} + +// NewPutMmdsParamsWithHTTPClient creates a new PutMmdsParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPutMmdsParamsWithHTTPClient(client *http.Client) *PutMmdsParams { + var () + return &PutMmdsParams{ + HTTPClient: client, + } +} + +/*PutMmdsParams contains all the parameters to send to the API endpoint +for the put mmds operation typically these are written to a http.Request +*/ +type PutMmdsParams struct { + + /*Body + The MMDS data store as JSON. + + */ + Body interface{} + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the put mmds params +func (o *PutMmdsParams) WithTimeout(timeout time.Duration) *PutMmdsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the put mmds params +func (o *PutMmdsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the put mmds params +func (o *PutMmdsParams) WithContext(ctx context.Context) *PutMmdsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the put mmds params +func (o *PutMmdsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the put mmds params +func (o *PutMmdsParams) WithHTTPClient(client *http.Client) *PutMmdsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the put mmds params +func (o *PutMmdsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the put mmds params +func (o *PutMmdsParams) WithBody(body interface{}) *PutMmdsParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the put mmds params +func (o *PutMmdsParams) SetBody(body interface{}) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PutMmdsParams) 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 +} diff --git a/virtcontainers/pkg/firecracker/client/operations/put_mmds_responses.go b/virtcontainers/pkg/firecracker/client/operations/put_mmds_responses.go new file mode 100644 index 0000000000..7b1e47b35e --- /dev/null +++ b/virtcontainers/pkg/firecracker/client/operations/put_mmds_responses.go @@ -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/runtime/virtcontainers/pkg/firecracker/client/models" +) + +// PutMmdsReader is a Reader for the PutMmds structure. +type PutMmdsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PutMmdsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 204: + result := NewPutMmdsNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 400: + result := NewPutMmdsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + result := NewPutMmdsDefault(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 + } +} + +// NewPutMmdsNoContent creates a PutMmdsNoContent with default headers values +func NewPutMmdsNoContent() *PutMmdsNoContent { + return &PutMmdsNoContent{} +} + +/*PutMmdsNoContent handles this case with default header values. + +MMDS data store created/updated. +*/ +type PutMmdsNoContent struct { +} + +func (o *PutMmdsNoContent) Error() string { + return fmt.Sprintf("[PUT /mmds][%d] putMmdsNoContent ", 204) +} + +func (o *PutMmdsNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPutMmdsBadRequest creates a PutMmdsBadRequest with default headers values +func NewPutMmdsBadRequest() *PutMmdsBadRequest { + return &PutMmdsBadRequest{} +} + +/*PutMmdsBadRequest handles this case with default header values. + +MMDS data store cannot be created due to bad input. +*/ +type PutMmdsBadRequest struct { + Payload *models.Error +} + +func (o *PutMmdsBadRequest) Error() string { + return fmt.Sprintf("[PUT /mmds][%d] putMmdsBadRequest %+v", 400, o.Payload) +} + +func (o *PutMmdsBadRequest) 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 +} + +// NewPutMmdsDefault creates a PutMmdsDefault with default headers values +func NewPutMmdsDefault(code int) *PutMmdsDefault { + return &PutMmdsDefault{ + _statusCode: code, + } +} + +/*PutMmdsDefault handles this case with default header values. + +Internal server error +*/ +type PutMmdsDefault struct { + _statusCode int + + Payload *models.Error +} + +// Code gets the status code for the put mmds default response +func (o *PutMmdsDefault) Code() int { + return o._statusCode +} + +func (o *PutMmdsDefault) Error() string { + return fmt.Sprintf("[PUT /mmds][%d] PutMmds default %+v", o._statusCode, o.Payload) +} + +func (o *PutMmdsDefault) 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 +} diff --git a/virtcontainers/pkg/firecracker/swagger_linux_amd64 b/virtcontainers/pkg/firecracker/swagger_linux_amd64 new file mode 100755 index 0000000000..e67f1fcafb Binary files /dev/null and b/virtcontainers/pkg/firecracker/swagger_linux_amd64 differ