in cloudformation/autoscaling/aws-autoscaling-autoscalinggroup.go [206:256]
func (r *AutoScalingGroup) UnmarshalJSON(b []byte) error {
type Properties AutoScalingGroup
res := &struct {
Type string
Properties *Properties
DependsOn []string
Metadata map[string]interface{}
DeletionPolicy string
UpdateReplacePolicy string
Condition string
UpdatePolicy *policies.UpdatePolicy
CreationPolicy *policies.CreationPolicy
}{}
dec := json.NewDecoder(bytes.NewReader(b))
dec.DisallowUnknownFields() // Force error if unknown field is found
if err := dec.Decode(&res); err != nil {
fmt.Printf("ERROR: %s\n", err)
return err
}
// If the resource has no Properties set, it could be nil
if res.Properties != nil {
*r = AutoScalingGroup(*res.Properties)
}
if res.DependsOn != nil {
r.AWSCloudFormationDependsOn = res.DependsOn
}
if res.Metadata != nil {
r.AWSCloudFormationMetadata = res.Metadata
}
if res.DeletionPolicy != "" {
r.AWSCloudFormationDeletionPolicy = policies.DeletionPolicy(res.DeletionPolicy)
}
if res.UpdateReplacePolicy != "" {
r.AWSCloudFormationUpdateReplacePolicy = policies.UpdateReplacePolicy(res.UpdateReplacePolicy)
}
if res.Condition != "" {
r.AWSCloudFormationCondition = res.Condition
}
if res.UpdatePolicy != nil {
r.AWSCloudFormationUpdatePolicy = res.UpdatePolicy
}
if res.CreationPolicy != nil {
r.AWSCloudFormationCreationPolicy = res.CreationPolicy
}
return nil
}