// UnmarshalYAML implements the Unmarshaller interface.
326402
func (u *Ulimits) UnmarshalYAML(unmarshal func(interface{}) error) error {
	ulimits := make(map[string]Ulimit)

	var mapType map[interface{}]interface{}
	if err := unmarshal(&mapType); err == nil {
		for mapKey, mapValue := range mapType {
			name, ok := mapKey.(string)
			if !ok {
				return fmt.Errorf("Cannot unmarshal '%v' to type %T into a string value", name, name)
			}
			var soft, hard int64
			switch mv := mapValue.(type) {
			case int:
				soft = int64(mv)
				hard = int64(mv)
			case map[interface{}]interface{}:
				if len(mv) != 2 {
					return fmt.Errorf("Failed to unmarshal Ulimit: %#v", mapValue)
				}
				for mkey, mvalue := range mv {
					switch mkey {
					case "soft":
						soft = int64(mvalue.(int))
					case "hard":
						hard = int64(mvalue.(int))
					default:
						// FIXME(vdemeester) Should we ignore or fail ?
						continue
					}
				}
			default:
				return fmt.Errorf("Failed to unmarshal Ulimit: %v, %T", mapValue, mapValue)
			}
			ulimits[name] = Ulimit{
				Name: name,
				ulimitValues: ulimitValues{
					Soft: soft,
					Hard: hard,
				},
			}
		}
		keys := make([]string, 0, len(ulimits))
		for key := range ulimits {
			keys = append(keys, key)
		}
		sort.Strings(keys)
		for _, key := range keys {
			u.Elements = append(u.Elements, ulimits[key])
		}
		return nil
	}

	return errors.New("Failed to unmarshal Ulimit")
}
834072
func (c *containerList) UnmarshalYAML(unmarshal func(interface{}) error) error {
	slice := yaml.MapSlice{}
	err := unmarshal(&slice)
	if err != nil {
		return err
	}

	for _, s := range slice {
		cc := container{}

		out, merr := yaml.Marshal(s.Value)
		if err != nil {
			return merr
		}

		err = yaml.Unmarshal(out, &cc)
		if err != nil {
			return err
		}
		if cc.Name == "" {
			cc.Name = fmt.Sprintf("%v", s.Key)
		}
		if cc.Image == "" {
			cc.Image = fmt.Sprintf("%v", s.Key)
		}
		c.containers = append(c.containers, &Container{
			Name:           cc.Name,
			Image:          cc.Image,
			Build:          cc.Build,
			Pull:           cc.Pull,
			Privileged:     cc.Privileged,
			Environment:    cc.Environment.Map(),
			Entrypoint:     cc.Entrypoint.Slice(),
			Command:        cc.Command.Slice(),
			Commands:       cc.Commands.Slice(),
			ExtraHosts:     cc.ExtraHosts.Slice(),
			Volumes:        cc.Volumes.Slice(),
			VolumesFrom:    cc.VolumesFrom.Slice(),
			Devices:        cc.Devices.Slice(),
			Network:        cc.Network,
			DNS:            cc.DNS.Slice(),
			DNSSearch:      cc.DNSSearch.Slice(),
			MemSwapLimit:   cc.MemSwapLimit,
			MemLimit:       cc.MemLimit,
			CPUQuota:       cc.CPUQuota,
			CPUShares:      cc.CPUShares,
			CPUSet:         cc.CPUSet,
			OomKillDisable: cc.OomKillDisable,
			Vargs:          cc.Vargs,
			AuthConfig: Auth{
				Username: cc.AuthConfig.Username,
				Password: cc.AuthConfig.Password,
				Email:    cc.AuthConfig.Email,
			},
			Constraints: cc.Constraints,
		})
	}
	return err
}
1199635
func (v *Uint64) UnmarshalEasyJSON(l *jlexer.Lexer) {
	if l.IsNull() {
		l.Skip()
		*v = Uint64{}
	} else {
		v.V = l.Uint64()
		v.Defined = true
	}
}
994504
func (a *FlagArray) UnmarshalYAML(unmarshal func(interface{}) error) error {
	var flags []string
	if err := unmarshal(&flags); err != nil {
		var flagstr string
		if err := unmarshal(&flagstr); err != nil {
			return err
		}
		*a = strings.Fields(flagstr)
	} else {
		*a = flags
	}
	return nil
}
495043
func (t *TLSConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
	toc := tlsconf{}

	if err := unmarshal(&toc); err != nil {
		return err
	}

	if toc.Cert == "" || toc.Key == "" {
		return nil
	}

	co, err := relay.LoadTLS(toc.Cert, toc.Key)

	if err != nil {
		return err
	}

	t.Certs = co
	return nil
}
188672
func (key *AppKey) Unmarshal(data []byte) error {
	*key = [16]byte{} // Reset the receiver
	return key.UnmarshalBinary(data)
}
1280271
func (gobMarshalerUnmarshaler) Unmarshal(data []byte, v interface{}) error {
	buff := bytes.NewBuffer(data)
	dec := gob.NewDecoder(buff)
	if err := dec.Decode(v); err != nil {
		return err
	}
	return nil
}
171110
func (r *regions) UnmarshalYAML(f func(interface{}) error) error {
	if err := f(&r.Map); err != nil {
		return err
	}
	return f(&r.Slice)
}
1163121
func (s *Strings) Unmarshal(data []byte) error {
	protoValues := &StringValues{}
	err := proto.Unmarshal(data, protoValues)
	if err != nil {
		return err
	}
	if protoValues.Values != nil {
		*s = protoValues.Values
	}
	return nil
}
524413
func (configJSON ConfigJSON) Unmarshal(configData string, config interface{}) {
	configBytes := []byte(configData)
	json.Unmarshal(configBytes, config)
}
68916
func (t *ExtendedMetricsType) UnmarshalYAML(unmarshal func(interface{}) error) error {
	var str string
	if err := unmarshal(&str); err != nil {
		return err
	}
	if str == "" {
		*t = DefaultExtendedMetricsType
		return nil
	}
	strs := make([]string, len(validExtendedMetricsTypes))
	for _, valid := range validExtendedMetricsTypes {
		if str == valid.String() {
			*t = valid
			return nil
		}
		strs = append(strs, "'"+valid.String()+"'")
	}
	return fmt.Errorf("invalid ExtendedMetricsType '%s' valid types are: %s",
		str, strings.Join(strs, ", "))
}
900274
func (s *MaporEqualSlice) UnmarshalYAML(unmarshal func(interface{}) error) error {
	parts, err := unmarshalToStringOrSepMapParts(unmarshal, "=")
	if err != nil {
		return err
	}
	*s = parts
	return nil
}
310208
func (*yamlMarshaller) Unmarshal(data []byte, v interface{}) error {
	return yaml.Unmarshal(data, v)
}
538451
func (u *URL) UnmarshalYAML(umf func(interface{}) error) error {
	path := ""
	if err := umf(&path); err != nil {
		return err
	}
	um, err := ParseURL(path)
	if err != nil {
		return err
	}
	*u = *um
	return nil
}
699293
func Unmarshal(bs []byte, v interface{}) error {
	bs, err := yaml.YAMLToJSON(bs)
	if err != nil {
		return err
	}
	return UnmarshalJSON(bs, v)
}
888927
func (jsonMarshalerUnmarshaler) Unmarshal(data []byte, v interface{}) error {
	return json.Unmarshal(data, v)
}
536759
func Unmarshal(data []byte, v interface{}) error {
	table, err := toml.Parse(data)
	if err != nil {
		return err
	}

	if err := toml.UnmarshalTable(table, v); err != nil {
		return err
	}

	if err := applyDefault(reflect.ValueOf(v), false); err != nil {
		return err
	}
	return nil
}