@@ -562,7 +562,9 @@ type RunInstancesInput struct {
562
562
// CPU's available values: 1, 2, 4, 8, 16
563
563
CPU * int `json:"cpu" name:"cpu" default:"1" location:"params"`
564
564
// CPUMax's available values: 1, 2, 4, 8, 16
565
- CPUMax * int `json:"cpu_max" name:"cpu_max" location:"params"`
565
+ CPUMax * int `json:"cpu_max" name:"cpu_max" location:"params"`
566
+ // CPUModel's available values: Westmere, SandyBridge, IvyBridge, Haswell, Broadwell
567
+ CPUModel * string `json:"cpu_model" name:"cpu_model" default:"Westmere" location:"params"`
566
568
Gpu * int `json:"gpu" name:"gpu" default:"0" location:"params"`
567
569
Hostname * string `json:"hostname" name:"hostname" location:"params"`
568
570
ImageID * string `json:"image_id" name:"image_id" location:"params"` // Required
@@ -635,6 +637,26 @@ func (v *RunInstancesInput) Validate() error {
635
637
}
636
638
}
637
639
640
+ if v .CPUModel != nil {
641
+ cpuModelValidValues := []string {"Westmere" , "SandyBridge" , "IvyBridge" , "Haswell" , "Broadwell" }
642
+ cpuModelParameterValue := fmt .Sprint (* v .CPUModel )
643
+
644
+ cpuModelIsValid := false
645
+ for _ , value := range cpuModelValidValues {
646
+ if value == cpuModelParameterValue {
647
+ cpuModelIsValid = true
648
+ }
649
+ }
650
+
651
+ if ! cpuModelIsValid {
652
+ return errors.ParameterValueNotAllowedError {
653
+ ParameterName : "CPUModel" ,
654
+ ParameterValue : cpuModelParameterValue ,
655
+ AllowedValues : cpuModelValidValues ,
656
+ }
657
+ }
658
+ }
659
+
638
660
if v .ImageID == nil {
639
661
return errors.ParameterRequiredError {
640
662
ParameterName : "ImageID" ,
0 commit comments