// UnmarshalOrganizationConfigPB decodes a config from binary protobuf data.
341421
func UnmarshalOrganizationConfigPB(data []byte, c *OrganizationConfig) error {
	return proto.Unmarshal(data, c)
}
103853
func UnmarshalConfigOrPanic(data []byte) *cb.Config {
	result, err := UnmarshalConfig(data)
	if err != nil {
		panic(err)
	}
	return result
}
1370109
func (z *Series) UnmarshalMsg(bts []byte) (o []byte, err error) {
	var field []byte
	_ = field
	var zb0001 uint32
	zb0001, bts, err = msgp.ReadMapHeaderBytes(bts)
	if err != nil {
		err = msgp.WrapError(err)
		return
	}
	for zb0001 > 0 {
		zb0001--
		field, bts, err = msgp.ReadMapKeyZC(bts)
		if err != nil {
			err = msgp.WrapError(err)
			return
		}
		switch msgp.UnsafeString(field) {
		case "Target":
			z.Target, bts, err = msgp.ReadStringBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "Target")
				return
			}
		case "Datapoints":
			var zb0002 uint32
			zb0002, bts, err = msgp.ReadArrayHeaderBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "Datapoints")
				return
			}
			if cap(z.Datapoints) >= int(zb0002) {
				z.Datapoints = (z.Datapoints)[:zb0002]
			} else {
				z.Datapoints = make([]schema.Point, zb0002)
			}
			for za0001 := range z.Datapoints {
				bts, err = z.Datapoints[za0001].UnmarshalMsg(bts)
				if err != nil {
					err = msgp.WrapError(err, "Datapoints", za0001)
					return
				}
			}
		case "Tags":
			var zb0003 uint32
			zb0003, bts, err = msgp.ReadMapHeaderBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "Tags")
				return
			}
			if z.Tags == nil {
				z.Tags = make(map[string]string, zb0003)
			} else if len(z.Tags) > 0 {
				for key := range z.Tags {
					delete(z.Tags, key)
				}
			}
			for zb0003 > 0 {
				var za0002 string
				var za0003 string
				zb0003--
				za0002, bts, err = msgp.ReadStringBytes(bts)
				if err != nil {
					err = msgp.WrapError(err, "Tags")
					return
				}
				za0003, bts, err = msgp.ReadStringBytes(bts)
				if err != nil {
					err = msgp.WrapError(err, "Tags", za0002)
					return
				}
				z.Tags[za0002] = za0003
			}
		case "Interval":
			z.Interval, bts, err = msgp.ReadUint32Bytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "Interval")
				return
			}
		case "QueryPatt":
			z.QueryPatt, bts, err = msgp.ReadStringBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "QueryPatt")
				return
			}
		case "QueryFrom":
			z.QueryFrom, bts, err = msgp.ReadUint32Bytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "QueryFrom")
				return
			}
		case "QueryTo":
			z.QueryTo, bts, err = msgp.ReadUint32Bytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "QueryTo")
				return
			}
		case "QueryCons":
			bts, err = z.QueryCons.UnmarshalMsg(bts)
			if err != nil {
				err = msgp.WrapError(err, "QueryCons")
				return
			}
		case "Consolidator":
			bts, err = z.Consolidator.UnmarshalMsg(bts)
			if err != nil {
				err = msgp.WrapError(err, "Consolidator")
				return
			}
		default:
			bts, err = msgp.Skip(bts)
			if err != nil {
				err = msgp.WrapError(err)
				return
			}
		}
	}
	o = bts
	return
}
206500
func (r *MachineInitReader) unmarshallConfigFile(file string) (map[string]interface{}, error) {
	raw, config, err := fileAsConfigMap(file)
	if err == nil {
		return config, nil
	}
	if !errors.IsNotValid(err) {
		return nil, errors.Trace(err)
	}

	// The data maybe be gzipped, base64 encoded, both, or neither.
	// If both, it has been gzipped, then base64 encoded.
	logger.Tracef("unmarshall failed (%s), file may be compressed", err.Error())

	zippedData, err := utils.Gunzip(raw)
	if err == nil {
		cfg, err := bytesAsConfigMap(zippedData)
		return cfg, errors.Trace(err)
	}
	logger.Tracef("Gunzip of %q failed (%s), maybe it is encoded", file, err)

	decodedData, err := base64.StdEncoding.DecodeString(string(raw))
	if err == nil {
		if buf, err := bytesAsConfigMap(decodedData); err == nil {
			return buf, nil
		}
	}
	logger.Tracef("Decoding of %q failed (%s), maybe it is encoded and gzipped", file, err)

	decodedZippedBuf, err := utils.Gunzip(decodedData)
	if err != nil {
		// During testing, it was found that the trusty vendor-data.txt.i file
		// can contain only the text "NONE", which doesn't unmarshall or decompress
		// we don't want to fail in that case.
		if r.config.Series == "trusty" {
			logger.Debugf("failed to unmarshall or decompress %q: %s", file, err)
			return nil, nil
		}
		return nil, errors.Annotatef(err, "cannot unmarshall or decompress %q", file)
	}

	cfg, err := bytesAsConfigMap(decodedZippedBuf)
	return cfg, errors.Trace(err)
}
424841
func (p *BeaconFreqAnsPayload) UnmarshalBinary(data []byte) error {
	if len(data) != 1 {
		return errors.New("lorawan: 1 byte of data is expected")
	}

	p.BeaconFrequencyOK = data[0]&(1<<0) != 0

	return nil
}
1201231
func (r *Registration) UnmarshalBinary(data []byte) error {
	reg, _, err := parseRegistration(data)
	if err != nil {
		return err
	}
	*r = *reg
	return nil
}
1039260
func (configMgr *ConfigurationManager) Unmarshal(obj interface{}) error {
	rv := reflect.ValueOf(obj)
	// only pointers are accepted
	if rv.Kind() != reflect.Ptr || rv.IsNil() {
		err := errors.New("invalid object supplied")
		openlogging.GetLogger().Error("invalid object supplied: " + err.Error())
		return err
	}

	return configMgr.unmarshal(rv, doNotConsiderTag)
}
846919
func UnmarshalMapping(data []byte, m *chronograf.Mapping) error {
	var pb Mapping
	if err := UnmarshalMappingPB(data, &pb); err != nil {
		return err
	}

	m.Provider = pb.Provider
	m.Scheme = pb.Scheme
	m.ProviderOrganization = pb.ProviderOrganization
	m.Organization = pb.Organization
	m.ID = pb.ID

	return nil
}
1350000
func UnmarshalConfigUpdateFromPayload(payload *cb.Payload) (*cb.ConfigUpdate, error) {
	configEnv, err := UnmarshalConfigEnvelope(payload.Data)
	if err != nil {
		return nil, err
	}
	configUpdateEnv, err := utils.EnvelopeToConfigUpdate(configEnv.LastUpdate)
	if err != nil {
		return nil, err
	}

	return UnmarshalConfigUpdate(configUpdateEnv.ConfigUpdate)
}
570353
func (z *arrayContainer) UnmarshalMsg(bts []byte) (o []byte, err error) {
	var field []byte
	_ = field
	var zcmr uint32
	zcmr, bts, err = msgp.ReadMapHeaderBytes(bts)
	if err != nil {
		return
	}
	for zcmr > 0 {
		zcmr--
		field, bts, err = msgp.ReadMapKeyZC(bts)
		if err != nil {
			return
		}
		switch msgp.UnsafeString(field) {
		case "content":
			var zajw uint32
			zajw, bts, err = msgp.ReadArrayHeaderBytes(bts)
			if err != nil {
				return
			}
			if cap(z.content) >= int(zajw) {
				z.content = (z.content)[:zajw]
			} else {
				z.content = make([]uint16, zajw)
			}
			for zxvk := range z.content {
				z.content[zxvk], bts, err = msgp.ReadUint16Bytes(bts)
				if err != nil {
					return
				}
			}
		default:
			bts, err = msgp.Skip(bts)
			if err != nil {
				return
			}
		}
	}
	o = bts
	return
}
911664
func (l *Locale) UnmarshalBinary(data []byte) error {
	buff := bytes.NewBuffer(data)
	obj := new(LocaleEncoding)

	decoder := gob.NewDecoder(buff)
	err := decoder.Decode(obj)
	if err != nil {
		return err
	}

	l.defaultDomain = obj.DefaultDomain
	l.lang = obj.Lang
	l.path = obj.Path

	// Decode Domains
	l.Domains = make(map[string]Translator)
	for k, v := range obj.Domains {
		var tr TranslatorEncoding
		buff := bytes.NewBuffer(v)
		trDecoder := gob.NewDecoder(buff)
		err := trDecoder.Decode(&tr)
		if err != nil {
			return err
		}

		l.Domains[k] = tr.GetTranslator()
	}

	return nil
}
268793
func UnmarshalOrganizationConfig(data []byte, c *chronograf.OrganizationConfig) error {
	var pb OrganizationConfig

	if err := UnmarshalOrganizationConfigPB(data, &pb); err != nil {
		return err
	}

	if pb.LogViewer == nil {
		return fmt.Errorf("log Viewer config is nil")
	}

	c.OrganizationID = pb.OrganizationID

	columns := make([]chronograf.LogViewerColumn, len(pb.LogViewer.Columns))

	for i, c := range pb.LogViewer.Columns {
		columns[i].Name = c.Name
		columns[i].Position = c.Position

		encodings := make([]chronograf.ColumnEncoding, len(c.Encodings))
		for j, e := range c.Encodings {
			encodings[j].Type = e.Type
			encodings[j].Value = e.Value
			encodings[j].Name = e.Name
		}

		columns[i].Encodings = encodings
	}

	c.LogViewer.Columns = columns

	return nil
}
502279
func (l *CFList) UnmarshalBinary(data []byte) error {
	if len(data) != 16 {
		return errors.New("lorawan: 16 bytes of data are expected")
	}

	l.CFListType = CFListType(data[15])

	switch l.CFListType {
	case CFListChannelMask:
		l.Payload = &CFListChannelMaskPayload{}
	default:
		l.Payload = &CFListChannelPayload{}
	}

	if err := l.Payload.UnmarshalBinary(false, data[:15]); err != nil {
		return err
	}

	return nil
}
1309183
func (z *MetricsDeleteResp) UnmarshalMsg(bts []byte) (o []byte, err error) {
	var field []byte
	_ = field
	var zb0001 uint32
	zb0001, bts, err = msgp.ReadMapHeaderBytes(bts)
	if err != nil {
		err = msgp.WrapError(err)
		return
	}
	for zb0001 > 0 {
		zb0001--
		field, bts, err = msgp.ReadMapKeyZC(bts)
		if err != nil {
			err = msgp.WrapError(err)
			return
		}
		switch msgp.UnsafeString(field) {
		case "DeletedDefs":
			z.DeletedDefs, bts, err = msgp.ReadIntBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "DeletedDefs")
				return
			}
		default:
			bts, err = msgp.Skip(bts)
			if err != nil {
				err = msgp.WrapError(err)
				return
			}
		}
	}
	o = bts
	return
}
1155675
func (e *Epoch) UnmarshalBinary(data []byte) error {
	if len(data) != EpochLength {
		return errors.New("Invalid data unmarshalling Epoch")
	}
	b := make([]byte, 8)
	copy(b, data)
	e.Level = b[7]
	b[7] = 0
	e.Time = binary.LittleEndian.Uint64(b)
	return nil
}
580571
func (i *IPs) UnmarshalBinary(p []byte) error {
	b := buffer.New(p)
	if b.Len()%net.IPv6len != 0 || b.Len() == 0 {
		return io.ErrUnexpectedEOF
	}

	*i = make(IPs, 0, b.Len()/net.IPv6len)
	for b.Len() > 0 {
		ip := make(net.IP, net.IPv6len)
		b.ReadBytes(ip)
		*i = append(*i, ip)
	}
	return nil
}
513996
func (r *ServiceConfigResponse) UnmarshalBinary(data []byte) error {
	dec := codec.NewDecoderBytes(data, msgpackHandle)

	type Alias ServiceConfigResponse
	var a Alias

	if err := dec.Decode(&a); err != nil {
		return err
	}

	*r = ServiceConfigResponse(a)

	var err error

	// Fix strings and maps in the returned maps
	r.ProxyConfig, err = lib.MapWalk(r.ProxyConfig)
	if err != nil {
		return err
	}
	for k := range r.UpstreamConfigs {
		r.UpstreamConfigs[k], err = lib.MapWalk(r.UpstreamConfigs[k])
		if err != nil {
			return err
		}
	}
	return nil
}