// UnmarshalYAML implements the yaml.Unmarshaler interface.
171110
func (r *regions) UnmarshalYAML(f func(interface{}) error) error {
	if err := f(&r.Map); err != nil {
		return err
	}
	return f(&r.Slice)
}
360107
func (p *StateInitializationParams) Unmarshal(data []byte) error {
	var internal stateInitializationParamsInternal
	if err := yaml.Unmarshal(data, &internal); err != nil {
		return errors.Annotate(err, "unmarshalling state initialization params")
	}
	var imageMetadata []*imagemetadata.ImageMetadata
	if err := json.Unmarshal([]byte(internal.CustomImageMetadataJSON), &imageMetadata); err != nil {
		return errors.Trace(err)
	}
	cfg, err := config.New(config.NoDefaults, internal.ControllerModelConfig)
	if err != nil {
		return errors.Trace(err)
	}
	controllerCloud, err := cloud.UnmarshalCloud([]byte(internal.ControllerCloud))
	if err != nil {
		return errors.Trace(err)
	}
	*p = StateInitializationParams{
		ControllerConfig:                        internal.ControllerConfig,
		ControllerModelConfig:                   cfg,
		ControllerModelEnvironVersion:           internal.ControllerModelEnvironVersion,
		ControllerInheritedConfig:               internal.ControllerInheritedConfig,
		RegionInheritedConfig:                   internal.RegionInheritedConfig,
		HostedModelConfig:                       internal.HostedModelConfig,
		BootstrapMachineInstanceId:              internal.BootstrapMachineInstanceId,
		BootstrapMachineConstraints:             internal.BootstrapMachineConstraints,
		BootstrapMachineHardwareCharacteristics: internal.BootstrapMachineHardwareCharacteristics,
		ModelConstraints:                        internal.ModelConstraints,
		CustomImageMetadata:                     imageMetadata,
		ControllerCloud:                         controllerCloud,
		ControllerCloudRegion:                   internal.ControllerCloudRegion,
		ControllerCloudCredentialName:           internal.ControllerCloudCredentialName,
		ControllerCloudCredential:               internal.ControllerCloudCredential,
	}
	return nil
}
198317
func (n *Node) Unmarshal(data []byte) error {
	newNode := Node{}
	if err := json.Unmarshal(data, &newNode); err != nil {
		return err
	}

	*n = newNode

	return nil
}
92818
func unmarshal(data []byte, ext string) *config {
	var config *config
	var err error
	if ext == ".json" {
		err = json.Unmarshal(data, &config)
	} else if ext == ".yml" || ext == ".yaml" {
		err = yaml.Unmarshal(data, &config)
	} else {
		panic(StatusError{errors.New("Unrecognized file extension"), 65})
	}
	if err != nil {
		err = displaySyntaxError(data, err)
		panic(StatusError{err, 65})
	}
	return config
}
1190551
func UnmarshalFromYaml(buffer []byte, gv schema.GroupVersion) (runtime.Object, error) {
	return UnmarshalFromYamlForCodecs(buffer, gv, clientsetscheme.Codecs)
}
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)
}
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
}
1005341
func (s *StringOrSlice) UnmarshalYAML(unmarshal func(interface{}) error) error {
	var sliceType []string
	err := unmarshal(&sliceType)
	if err == nil {
		s.parts = sliceType
		return nil
	}

	var stringType string
	err = unmarshal(&stringType)
	if err == nil {
		sliceType = make([]string, 0, 1)
		s.parts = append(sliceType, string(stringType))
		return nil
	}
	return err
}
1117125
func (storage *Storage) UnmarshalYAML(unmarshal func(interface{}) error) error {
	var storageMap map[string]Parameters
	err := unmarshal(&storageMap)
	if err == nil {
		if len(storageMap) > 1 {
			types := make([]string, 0, len(storageMap))
			for k := range storageMap {
				switch k {
				case "maintenance":
					// allow for configuration of maintenance
				case "cache":
					// allow configuration of caching
				case "delete":
					// allow configuration of delete
				case "redirect":
					// allow configuration of redirect
				default:
					types = append(types, k)
				}
			}

			if len(types) > 1 {
				return fmt.Errorf("must provide exactly one storage type. Provided: %v", types)
			}
		}
		*storage = storageMap
		return nil
	}

	var storageType string
	err = unmarshal(&storageType)
	if err == nil {
		*storage = Storage{storageType: Parameters{}}
		return nil
	}

	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
}
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
}
394729
func (v *Volumes) UnmarshalYAML(unmarshal func(interface{}) error) error {
	var sliceType []interface{}
	if err := unmarshal(&sliceType); err == nil {
		v.Volumes = []*Volume{}
		for _, volume := range sliceType {
			name, ok := volume.(string)
			if !ok {
				return fmt.Errorf("Cannot unmarshal '%v' to type %T into a string value", name, name)
			}
			elts := strings.SplitN(name, ":", 3)
			var vol *Volume
			switch {
			case len(elts) == 1:
				vol = &Volume{
					Destination: elts[0],
				}
			case len(elts) == 2:
				vol = &Volume{
					Source:      elts[0],
					Destination: elts[1],
				}
			case len(elts) == 3:
				vol = &Volume{
					Source:      elts[0],
					Destination: elts[1],
					AccessMode:  elts[2],
				}
			default:
				// FIXME
				return fmt.Errorf("")
			}
			v.Volumes = append(v.Volumes, vol)
		}
		return nil
	}

	return errors.New("Failed to unmarshal Volumes")
}
224088
func (s *Serializer) Unmarshal(data []byte, v interface{}) error {
	pb, ok := v.(proto.Message)
	if !ok {
		return constants.ErrWrongValueType
	}
	return proto.Unmarshal(data, pb)
}
825117
func (eui *AppEUI) Unmarshal(data []byte) error {
	*eui = [8]byte{} // Reset the receiver
	return eui.UnmarshalBinary(data)
}
400319
func (ln *LabelName) UnmarshalYAML(unmarshal func(interface{}) error) error {
	var s string
	if err := unmarshal(&s); err != nil {
		return err
	}
	if !LabelName(s).IsValid() {
		return fmt.Errorf("%q is not a valid label name", s)
	}
	*ln = LabelName(s)
	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")
}