// FromConfig creates the struct representation of a service step
FromConfig creates the struct representation of a service step
// FromConfig creates the struct representation of a service step
func (service *Service) FromConfig(configYaml map[string]interface{}) error {
	service.Kind = KindService
	if description, ok := configYaml["Description"]; ok {
		service.Description = description.(string)
	}
	if preferencesYaml, ok := configYaml["Preferences"].(map[string]interface{}); ok {
		if name, ok := preferencesYaml["Name"]; ok {
			service.Name = name.(string)
		}
		if action, ok := preferencesYaml["Action"].(string); ok {
			if action != "start" && action != "stop" {
				return fmt.Errorf("action for service task has to be \"start\" or \"stop\"")
			}
			service.Action = action
		}
	} else {
		return fmt.Errorf("the preferences \"Name\" and \"Action\" have to he defined for step type %s", KindService)
	}
	return nil
}
func ( service * Service ) FromConfig ( configYaml map [ string ] interface { } ) error { service . Kind = KindService if description , ok := configYaml [ " " ] ; ok { service . Description = description . ( string ) } if preferencesYaml , ok := configYaml [ " " ] . ( map [ string ] interface { } ) ; ok { if name , ok := preferencesYaml [ " " ] ; ok { service . Name = name . ( string ) } if action , ok := preferencesYaml [ " " ] . ( string ) ; ok { if action != " " && action != " " { return fmt . Errorf ( " \" \" \" \" " ) } service . Action = action } } else { return fmt . Errorf ( " \" \" \" \" " , KindService ) } return nil }
FromConfig creates the struct representation of a service step
FromConfig creates the struct representation of a service step