github.com/kubernetes-incubator/kube-aws@v0.16.4/pkg/api/lauch_specification.go (about) 1 package api 2 3 import ( 4 "fmt" 5 ) 6 7 type LaunchSpecification struct { 8 WeightedCapacity int `yaml:"weightedCapacity,omitempty"` 9 InstanceType string `yaml:"instanceType,omitempty"` 10 SpotPrice string `yaml:"spotPrice,omitempty"` 11 RootVolume `yaml:"rootVolume,omitempty"` 12 } 13 14 func NewLaunchSpecification(weightedCapacity int, instanceType string) LaunchSpecification { 15 return LaunchSpecification{ 16 WeightedCapacity: weightedCapacity, 17 InstanceType: instanceType, 18 } 19 } 20 21 func (s *LaunchSpecification) UnmarshalYAML(unmarshal func(interface{}) error) error { 22 type t LaunchSpecification 23 work := t(LaunchSpecification{}) 24 if err := unmarshal(&work); err != nil { 25 return fmt.Errorf("failed to parse node pool config: %v", err) 26 } 27 *s = LaunchSpecification(work) 28 29 return nil 30 } 31 32 func (c LaunchSpecification) Validate() error { 33 if err := c.RootVolume.Validate(); err != nil { 34 return err 35 } 36 37 return nil 38 }