// ToStringMap returns a map of key/value metadata about the host memory
// where memory sizes are reported in Kb
429518
func (m *Memory) ToStringMap() map[string]string {
	return map[string]string{
		"host_mem_total": strconv.FormatFloat(m.Total.Kilobytes(), 'f', 6, 64),
	}
}
214603
func (p *parserMixin) StringMap() (target *map[string]string) {
	target = &(map[string]string{})
	p.StringMapVar(target)
	return
}
1185656
func ConvertKVStringsToMap(values []string) map[string]string {
	result := make(map[string]string, len(values))
	for _, value := range values {
		kv := strings.SplitN(value, "=", 2)
		if len(kv) == 1 {
			result[kv[0]] = ""
		} else {
			result[kv[0]] = kv[1]
		}
	}

	return result
}
282224
func SetNestedStringMap(obj map[string]interface{}, value map[string]string, fields ...string) error {
	m := make(map[string]interface{}, len(value)) // convert map[string]string into map[string]interface{}
	for k, v := range value {
		m[k] = v
	}
	return setNestedFieldNoCopy(obj, m, fields...)
}
1132127
func StringMapPtr(ms map[string]string) *map[string]*string {
	msp := make(map[string]*string, len(ms))
	for k, s := range ms {
		msp[k] = StringPtr(s)
	}
	return &msp
}
1054504
func CastToMapStringInterface(value interface{}) (map[string]interface{}, bool) {
	castedValue, ok := value.(map[interface{}]interface{})
	desiredMap := map[string]interface{}{}
	for key, value := range castedValue {
		keyStr, ok := key.(string)
		if !ok {
			return map[string]interface{}{}, false
		}
		desiredMap[keyStr] = value
	}
	return desiredMap, ok
}
103470
func ToStringMapStringE(i interface{}) (map[string]string, error) {
	var m = map[string]string{}

	switch v := i.(type) {
	case map[string]string:
		return v, nil
	case map[string]interface{}:
		for k, val := range v {
			m[ToString(k)] = ToString(val)
		}
		return m, nil
	case map[interface{}]string:
		for k, val := range v {
			m[ToString(k)] = ToString(val)
		}
		return m, nil
	case map[interface{}]interface{}:
		for k, val := range v {
			m[ToString(k)] = ToString(val)
		}
		return m, nil
	case string:
		err := jsonStringToObject(v, &m)
		return m, err
	default:
		return m, fmt.Errorf("unable to cast %#v of type %T to map[string]string", i, i)
	}
}
1356556
func convertMapsToStringKeyMaps(i interface{}) (res interface{}, err error) {
	switch reflect.TypeOf(i).Kind() {
	case reflect.Map:
		res := make(map[string]interface{})
		v := reflect.ValueOf(i)
		for _, k := range v.MapKeys() {
			res[fmt.Sprintf("%v", k)], err = convertMapsToStringKeyMaps(v.MapIndex(k).Interface())
			if err != nil {
				return nil, err
			}
		}
		return res, nil
	case reflect.Slice:
		res := make([]interface{}, len(i.([]interface{})))
		for k, v := range i.([]interface{}) {
			res[k], err = convertMapsToStringKeyMaps(v)
			if err != nil {
				return nil, err
			}
		}
		return res, nil

	default:
		return i, nil
	}
}
496595
func MergeStringStringMap(m1, m2 map[string]string) map[string]string {
	mergedMap := CloneStringStringMap(m1)
	for k, v := range m2 {
		mergedMap[k] = v
	}
	return mergedMap
}
140712
func (s setMap) SetStringMap(key string, value interface{}) {
	// because these methods are meant to be chained without intermediate
	// checks for nil, we are likely to get interfaces with dynamic types but
	// a nil value.
	if reflect.ValueOf(value).IsNil() {
		return
	}

	m := make(map[string]interface{})

	switch value := value.(type) {
	case map[string]string:
		for k, v := range value {
			m[k] = v
		}
	case map[string]*string:
		for k, v := range value {
			if v == nil {
				continue
			}
			m[k] = *v
		}
	case map[string]interface{}:
		for k, v := range value {
			if v == nil {
				continue
			}

			switch v := v.(type) {
			case string:
				m[k] = v
			case *string:
				if v != nil {
					m[k] = *v
				}
			default:
				panic(fmt.Sprintf("unknown type for SetString: %T", v))
			}
		}
	}

	// catch the case where the interface wasn't nil, but we had no non-nil values
	if len(m) > 0 {
		s[key] = m
	}
}
1111295
func (s *HeaderStorer) mapToHeader(headerMap map[string]string) (string, error) {
	result, err := json.Marshal(headerMap)
	if err != nil {
		return "", err
	}
	return base64.StdEncoding.EncodeToString(result), nil
}
439291
func mapBytesToString(m map[string]interface{}) {
	for k, v := range m {
		if b, ok := v.([]byte); ok {
			m[k] = string(b)
		}
	}
}
471822
func copyStringInterfaceMap(m map[string]interface{}) map[string]interface{} {
	ret := make(map[string]interface{}, len(m))
	for k, v := range m {
		ret[k] = v
	}
	return ret
}
5108
func CopyStringMapSlices(a map[string][]string) map[string][]string {
	if a == nil {
		return nil
	}

	out := make(map[string][]string)
	for key, values := range a {
		vout := make([]string, len(values))
		copy(vout, values)
		out[key] = vout
	}

	return out
}
1107202
func StringMap(src map[string]string) map[string]*string {
	dst := make(map[string]*string)
	for k, val := range src {
		v := val
		dst[k] = &v
	}
	return dst
}
1023705
func ToStringMapStringSliceE(i interface{}) (map[string][]string, error) {
	var m = map[string][]string{}

	switch v := i.(type) {
	case map[string][]string:
		return v, nil
	case map[string][]interface{}:
		for k, val := range v {
			m[ToString(k)] = ToStringSlice(val)
		}
		return m, nil
	case map[string]string:
		for k, val := range v {
			m[ToString(k)] = []string{val}
		}
	case map[string]interface{}:
		for k, val := range v {
			switch vt := val.(type) {
			case []interface{}:
				m[ToString(k)] = ToStringSlice(vt)
			case []string:
				m[ToString(k)] = vt
			default:
				m[ToString(k)] = []string{ToString(val)}
			}
		}
		return m, nil
	case map[interface{}][]string:
		for k, val := range v {
			m[ToString(k)] = ToStringSlice(val)
		}
		return m, nil
	case map[interface{}]string:
		for k, val := range v {
			m[ToString(k)] = ToStringSlice(val)
		}
		return m, nil
	case map[interface{}][]interface{}:
		for k, val := range v {
			m[ToString(k)] = ToStringSlice(val)
		}
		return m, nil
	case map[interface{}]interface{}:
		for k, val := range v {
			key, err := ToStringE(k)
			if err != nil {
				return m, fmt.Errorf("unable to cast %#v of type %T to map[string][]string", i, i)
			}
			value, err := ToStringSliceE(val)
			if err != nil {
				return m, fmt.Errorf("unable to cast %#v of type %T to map[string][]string", i, i)
			}
			m[key] = value
		}
	case string:
		err := jsonStringToObject(v, &m)
		return m, err
	default:
		return m, fmt.Errorf("unable to cast %#v of type %T to map[string][]string", i, i)
	}
	return m, nil
}
138403
func (e *EC2Metadata) ToStringMap() map[string]string {
	metadata := map[string]string{
		"aws_availability_zone": e.AvailabilityZone,
		"aws_instance_type":     e.InstanceType,
		"aws_instance_id":       e.InstanceID,
		"aws_image_id":          e.ImageID,
		"aws_account_id":        e.AccountID,
		"aws_region":            e.Region,
		"aws_architecture":      e.Architecture,
		"AWSUniqueId":           e.AWSUniqueID,
	}

	return metadata
}