github.com/kata-containers/runtime@v0.0.0-20210505125100-04f29832a923/virtcontainers/pkg/firecracker/client/models/cpu_template.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/validate" 15 ) 16 17 // 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. 18 // swagger:model CpuTemplate 19 type CPUTemplate string 20 21 const ( 22 23 // CPUTemplateC3 captures enum value "C3" 24 CPUTemplateC3 CPUTemplate = "C3" 25 26 // CPUTemplateT2 captures enum value "T2" 27 CPUTemplateT2 CPUTemplate = "T2" 28 ) 29 30 // for schema 31 var cpuTemplateEnum []interface{} 32 33 func init() { 34 var res []CPUTemplate 35 if err := json.Unmarshal([]byte(`["C3","T2"]`), &res); err != nil { 36 panic(err) 37 } 38 for _, v := range res { 39 cpuTemplateEnum = append(cpuTemplateEnum, v) 40 } 41 } 42 43 func (m CPUTemplate) validateCPUTemplateEnum(path, location string, value CPUTemplate) error { 44 if err := validate.Enum(path, location, value, cpuTemplateEnum); err != nil { 45 return err 46 } 47 return nil 48 } 49 50 // Validate validates this Cpu template 51 func (m CPUTemplate) Validate(formats strfmt.Registry) error { 52 var res []error 53 54 // value enum 55 if err := m.validateCPUTemplateEnum("", "body", m); err != nil { 56 return err 57 } 58 59 if len(res) > 0 { 60 return errors.CompositeValidationError(res...) 61 } 62 return nil 63 }