github.com/kata-containers/runtime@v0.0.0-20210505125100-04f29832a923/virtcontainers/pkg/firecracker/client/models/instance_info.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package models 4 5 // This file was generated by the swagger tool. 6 // Editing this file might prove futile when you re-run the swagger generate command 7 8 import ( 9 "encoding/json" 10 11 strfmt "github.com/go-openapi/strfmt" 12 13 "github.com/go-openapi/errors" 14 "github.com/go-openapi/swag" 15 "github.com/go-openapi/validate" 16 ) 17 18 // InstanceInfo Describes MicroVM instance information. 19 // swagger:model InstanceInfo 20 type InstanceInfo struct { 21 22 // MicroVM / instance ID. 23 // Required: true 24 ID *string `json:"id"` 25 26 // The current detailed state of the Firecracker instance. This value is read-only for the control-plane. 27 // Required: true 28 // Enum: [Uninitialized Starting Running] 29 State *string `json:"state"` 30 31 // MicroVM hypervisor build version. 32 // Required: true 33 VmmVersion *string `json:"vmm_version"` 34 } 35 36 // Validate validates this instance info 37 func (m *InstanceInfo) Validate(formats strfmt.Registry) error { 38 var res []error 39 40 if err := m.validateID(formats); err != nil { 41 res = append(res, err) 42 } 43 44 if err := m.validateState(formats); err != nil { 45 res = append(res, err) 46 } 47 48 if err := m.validateVmmVersion(formats); err != nil { 49 res = append(res, err) 50 } 51 52 if len(res) > 0 { 53 return errors.CompositeValidationError(res...) 54 } 55 return nil 56 } 57 58 func (m *InstanceInfo) validateID(formats strfmt.Registry) error { 59 60 if err := validate.Required("id", "body", m.ID); err != nil { 61 return err 62 } 63 64 return nil 65 } 66 67 var instanceInfoTypeStatePropEnum []interface{} 68 69 func init() { 70 var res []string 71 if err := json.Unmarshal([]byte(`["Uninitialized","Starting","Running"]`), &res); err != nil { 72 panic(err) 73 } 74 for _, v := range res { 75 instanceInfoTypeStatePropEnum = append(instanceInfoTypeStatePropEnum, v) 76 } 77 } 78 79 const ( 80 81 // InstanceInfoStateUninitialized captures enum value "Uninitialized" 82 InstanceInfoStateUninitialized string = "Uninitialized" 83 84 // InstanceInfoStateStarting captures enum value "Starting" 85 InstanceInfoStateStarting string = "Starting" 86 87 // InstanceInfoStateRunning captures enum value "Running" 88 InstanceInfoStateRunning string = "Running" 89 ) 90 91 // prop value enum 92 func (m *InstanceInfo) validateStateEnum(path, location string, value string) error { 93 if err := validate.Enum(path, location, value, instanceInfoTypeStatePropEnum); err != nil { 94 return err 95 } 96 return nil 97 } 98 99 func (m *InstanceInfo) validateState(formats strfmt.Registry) error { 100 101 if err := validate.Required("state", "body", m.State); err != nil { 102 return err 103 } 104 105 // value enum 106 if err := m.validateStateEnum("state", "body", *m.State); err != nil { 107 return err 108 } 109 110 return nil 111 } 112 113 func (m *InstanceInfo) validateVmmVersion(formats strfmt.Registry) error { 114 115 if err := validate.Required("vmm_version", "body", m.VmmVersion); err != nil { 116 return err 117 } 118 119 return nil 120 } 121 122 // MarshalBinary interface implementation 123 func (m *InstanceInfo) MarshalBinary() ([]byte, error) { 124 if m == nil { 125 return nil, nil 126 } 127 return swag.WriteJSON(m) 128 } 129 130 // UnmarshalBinary interface implementation 131 func (m *InstanceInfo) UnmarshalBinary(b []byte) error { 132 var res InstanceInfo 133 if err := swag.ReadJSON(b, &res); err != nil { 134 return err 135 } 136 *m = res 137 return nil 138 }