// UnmarshalYAML implements the Unmarshaller interface.
190105
func (s *Stringorslice) UnmarshalYAML(unmarshal func(interface{}) error) error {
	var stringType string
	if err := unmarshal(&stringType); err == nil {
		*s = []string{stringType}
		return nil
	}

	var sliceType []interface{}
	if err := unmarshal(&sliceType); err == nil {
		parts, err := toStrings(sliceType)
		if err != nil {
			return err
		}
		*s = parts
		return nil
	}

	return errors.New("Failed to unmarshal Stringorslice")
}
699293
func Unmarshal(bs []byte, v interface{}) error {
	bs, err := yaml.YAMLToJSON(bs)
	if err != nil {
		return err
	}
	return UnmarshalJSON(bs, v)
}
908026
func (s *Command) UnmarshalYAML(unmarshal func(interface{}) error) error {
	var stringType string
	if err := unmarshal(&stringType); err == nil {
		parts, err := shlex.Split(stringType)
		if err != nil {
			return err
		}
		*s = parts
		return nil
	}

	var sliceType []interface{}
	if err := unmarshal(&sliceType); err == nil {
		parts, err := toStrings(sliceType)
		if err != nil {
			return err
		}
		*s = parts
		return nil
	}

	var interfaceType interface{}
	if err := unmarshal(&interfaceType); err == nil {
		fmt.Println(interfaceType)
	}

	return errors.New("Failed to unmarshal Command")
}
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
}
1188998
func (ua *Uint64Array) UnmarshalJSON(data []byte) error {
	if isNull(data) {
		ua.Valid = false
		return nil
	}
	if data == nil {
		ua.Uint64Array, ua.Valid = nil, false
		return nil
	}
	ua.Valid = true
	return json.Unmarshal(data, &ua.Uint64Array)
}
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
}
1321683
func (auth *Auth) UnmarshalYAML(unmarshal func(interface{}) error) error {
	var m map[string]Parameters
	err := unmarshal(&m)
	if err == nil {
		if len(m) > 1 {
			types := make([]string, 0, len(m))
			for k := range m {
				types = append(types, k)
			}

			// TODO(stevvooe): May want to change this slightly for
			// authorization to allow multiple challenges.
			return fmt.Errorf("must provide exactly one type. Provided: %v", types)

		}
		*auth = m
		return nil
	}

	var authType string
	err = unmarshal(&authType)
	if err == nil {
		*auth = Auth{authType: Parameters{}}
		return nil
	}

	return err
}
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
}
171110
func (r *regions) UnmarshalYAML(f func(interface{}) error) error {
	if err := f(&r.Map); err != nil {
		return err
	}
	return f(&r.Slice)
}
697885
func (c *Constraint) UnmarshalYAML(unmarshal func(interface{}) error) error {

	var out1 = struct {
		Include types.StringOrSlice
		Exclude types.StringOrSlice
	}{}

	var out2 types.StringOrSlice

	unmarshal(&out1)
	unmarshal(&out2)

	c.Exclude = out1.Exclude.Slice()
	c.Include = append(
		out1.Include.Slice(),
		out2.Slice()...,
	)
	return nil
}
1371860
func (n *networkList) UnmarshalYAML(unmarshal func(interface{}) error) error {
	slice := yaml.MapSlice{}
	err := unmarshal(&slice)
	if err != nil {
		return err
	}

	for _, s := range slice {
		nn := Network{}

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

		err = yaml.Unmarshal(out, &nn)
		if err != nil {
			return err
		}
		if nn.Name == "" {
			nn.Name = fmt.Sprintf("%v", s.Key)
		}
		if nn.Driver == "" {
			nn.Driver = "bridge"
		}
		n.networks = append(n.networks, &nn)
	}
	return err
}
1327537
func (v *volumeList) UnmarshalYAML(unmarshal func(interface{}) error) error {
	slice := yaml.MapSlice{}
	err := unmarshal(&slice)
	if err != nil {
		return err
	}

	for _, s := range slice {
		vv := Volume{}
		out, merr := yaml.Marshal(s.Value)
		if merr != nil {
			return merr
		}

		err = yaml.Unmarshal(out, &vv)
		if err != nil {
			return err
		}
		if vv.Name == "" {
			vv.Name = fmt.Sprintf("%v", s.Key)
		}
		if vv.Driver == "" {
			vv.Driver = "local"
		}
		v.volumes = append(v.volumes, &vv)
	}
	return err
}
491158
func (dc *DefinitionChoice) UnmarshalYAML(unmarshaler func(interface{}) error) error {

	simpleDefinition := new(string)
	parameterizedDefinition := make(map[string]DefinitionParameters)

	var err error

	// Unmarshal into a string
	if err = unmarshaler(simpleDefinition); err == nil {
		dc.Name = *simpleDefinition
		dc.Parameters = nil
	} else if err = unmarshaler(parameterizedDefinition); err == nil {
		// Didn't work? Now unmarshal into a map
		for choice, params := range parameterizedDefinition {
			dc.Name = choice
			dc.Parameters = params
		}
	}

	// Still didn't work? Panic

	return err
}
900274
func (s *MaporEqualSlice) UnmarshalYAML(unmarshal func(interface{}) error) error {
	parts, err := unmarshalToStringOrSepMapParts(unmarshal, "=")
	if err != nil {
		return err
	}
	*s = parts
	return nil
}
1199138
func (b *Block) Unmarshal(bs []byte) error {
	return cdc.UnmarshalBinaryBare(bs, b)
}
394327
func (a *BasicAuth) UnmarshalYAML(unmarshal func(interface{}) error) error {
	type plain BasicAuth
	return unmarshal((*plain)(a))
}
1213229
func (key *AppSKey) Unmarshal(data []byte) error {
	*key = [16]byte{} // Reset the receiver
	return key.UnmarshalBinary(data)
}