// UnmarshalYAML unmarshalls the incoming data for use
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
}
900274
func (s *MaporEqualSlice) UnmarshalYAML(unmarshal func(interface{}) error) error {
	parts, err := unmarshalToStringOrSepMapParts(unmarshal, "=")
	if err != nil {
		return err
	}
	*s = parts
	return nil
}
1173363
func (s *StringorInt) UnmarshalYAML(unmarshal func(interface{}) error) error {
	var intType int64
	if err := unmarshal(&intType); err == nil {
		*s = StringorInt(intType)
		return nil
	}

	var stringType string
	if err := unmarshal(&stringType); err == nil {
		intType, err := strconv.ParseInt(stringType, 10, 64)

		if err != nil {
			return err
		}
		*s = StringorInt(intType)
		return nil
	}

	return errors.New("Failed to unmarshal StringorInt")
}
309228
func (m *RuleMatchers) UnmarshalYAML(unmarshal func(interface{}) error) error {
	// Use a map[string]interface{} for validation purposes. If we used a
	// map[string][]string, the YAML unmarshaler would coerce non-string values
	// into string values, breaking our ability to validate configs. i.e., it
	// would change `title: [7, []]` into `title: ["7", "[]"]`. Using a
	// map[string]interface{} tells the unmarshaler to use natural types.
	var rawData map[string][]interface{}
	err := unmarshal(&rawData)
	if err != nil {
		return err
	}

	data := map[string][]string{}
	for key, arr := range rawData {
		data[key] = []string{}

		for _, val := range arr {
			switch v := val.(type) {
			case string:
				data[key] = append(data[key], v)
			case bool:
				if v {
					data[key] = append(data[key], "true")
				} else {
					data[key] = append(data[key], "false")
				}
			default:
				return fmt.Errorf(`Invalid log-router matcher -- key: "%s", value: %+#v.  `+
					"Only strings can be matched.", key, val)
			}
		}
	}

	for field, vals := range data {
		for _, val := range vals {
			if val == "*" && len(vals) > 1 {
				return fmt.Errorf("Invalid matcher values in %s.\n"+
					"Wildcard matcher can't co-exist with other matchers.", field)
			}
		}
	}

	*m = data
	return nil
}
524413
func (configJSON ConfigJSON) Unmarshal(configData string, config interface{}) {
	configBytes := []byte(configData)
	json.Unmarshal(configBytes, config)
}
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
}
361543
func (d Data) Unmarshal(ptr interface{}) error {
	d.Rewind()
	d.Next()
	err := amqp.UnmarshalUnsafe(d.CPtr(), ptr)
	return err
}
1107306
func (b *Build) UnmarshalYAML(unmarshal func(interface{}) error) error {
	err := unmarshal(&b.Context)
	if err == nil {
		return nil
	}
	out := struct {
		Context    string
		Dockerfile string
		Args       map[string]string
	}{}
	err = unmarshal(&out)
	b.Context = out.Context
	b.Args = out.Args
	b.Dockerfile = out.Dockerfile
	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
}
571740
func (sp *SerializerProto) Unmarshal(data []byte, protoData proto.Message) error {
	return proto.Unmarshal(data, protoData)
}
2616
func (n *External) UnmarshalYAML(unmarshal func(interface{}) error) error {
	if err := unmarshal(&n.External); err == nil {
		return nil
	}
	var dummyExternal struct {
		Name string
	}

	err := unmarshal(&dummyExternal)
	if err != nil {
		return err
	}
	n.Name = dummyExternal.Name
	n.External = true

	return nil
}
1246081
func (*ProtoMarshaller) Unmarshal(data []byte, value interface{}) error {
	message, ok := value.(proto.Message)
	if !ok {
		return errors.New("unable to unmarshal non proto field")
	}
	return proto.Unmarshal(data, message)
}
770284
func (m *Unmarshaller) Unmarshal(b []byte, obj interface{}) error {
	return m.Decode(bytes.NewReader(b), obj)
}
446223
func (c *Credential) UnmarshalYAML(unmarshal func(interface{}) error) error {
	var internal credentialInternal
	if err := unmarshal(&internal); err != nil {
		return err
	}
	*c = Credential{authType: internal.AuthType, attributes: internal.Attributes}
	return nil
}
276073
func (m *MockSerializer) Unmarshal(arg0 []byte, arg1 interface{}) error {
	ret := m.ctrl.Call(m, "Unmarshal", arg0, arg1)
	ret0, _ := ret[0].(error)
	return ret0
}
932963
func (j *JSONMarshaler) Unmarshal(data []byte, v interface{}) error {
	return json.Unmarshal(data, v)
}
893391
func (s *MemStringorInt) UnmarshalYAML(unmarshal func(interface{}) error) error {
	var intType int64
	if err := unmarshal(&intType); err == nil {
		*s = MemStringorInt(intType)
		return nil
	}

	var stringType string
	if err := unmarshal(&stringType); err == nil {
		intType, err := units.RAMInBytes(stringType)

		if err != nil {
			return err
		}
		*s = MemStringorInt(intType)
		return nil
	}

	return errors.New("Failed to unmarshal MemStringorInt")
}