mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-01-06 07:54:22 +01:00
firecracker: generated code
``` 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 ``` Signed-off-by: Manohar Castelino <manohar.r.castelino@intel.com>
This commit is contained in:
67
virtcontainers/pkg/firecracker/client/models/boot_source.go
Normal file
67
virtcontainers/pkg/firecracker/client/models/boot_source.go
Normal file
@@ -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
|
||||
}
|
||||
63
virtcontainers/pkg/firecracker/client/models/cpu_template.go
Normal file
63
virtcontainers/pkg/firecracker/client/models/cpu_template.go
Normal file
@@ -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
|
||||
}
|
||||
143
virtcontainers/pkg/firecracker/client/models/drive.go
Normal file
143
virtcontainers/pkg/firecracker/client/models/drive.go
Normal file
@@ -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
|
||||
}
|
||||
44
virtcontainers/pkg/firecracker/client/models/error.go
Normal file
44
virtcontainers/pkg/firecracker/client/models/error.go
Normal file
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
144
virtcontainers/pkg/firecracker/client/models/instance_info.go
Normal file
144
virtcontainers/pkg/firecracker/client/models/instance_info.go
Normal file
@@ -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
|
||||
}
|
||||
149
virtcontainers/pkg/firecracker/client/models/logger.go
Normal file
149
virtcontainers/pkg/firecracker/client/models/logger.go
Normal file
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
96
virtcontainers/pkg/firecracker/client/models/rate_limiter.go
Normal file
96
virtcontainers/pkg/firecracker/client/models/rate_limiter.go
Normal file
@@ -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
|
||||
}
|
||||
112
virtcontainers/pkg/firecracker/client/models/token_bucket.go
Normal file
112
virtcontainers/pkg/firecracker/client/models/token_bucket.go
Normal file
@@ -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
|
||||
}
|
||||
86
virtcontainers/pkg/firecracker/client/models/vsock.go
Normal file
86
virtcontainers/pkg/firecracker/client/models/vsock.go
Normal file
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user