// Returns a slice of string keywords for the types supported by ConfigValue.
963850
func SupportedTypes() []string {
	// This is kind of a hack but keeps the definition of types here in
	// ctypes.go. If you create a new ConfigValue type be sure and add here
	// to return the Type() response. This will cause any depedant components
	// to acknowledge and use that type.
	t := []string{
		// String
		ConfigValueStr{}.Type(),
		// Integer
		ConfigValueInt{}.Type(),
		// Float
		ConfigValueFloat{}.Type(),
		// Bool
		ConfigValueBool{}.Type(),
	}
	return t
}
376564
func (config *Config) GetString(key string, defaultValue string) (string, error) {
	value, err := config.Get(key, defaultValue)
	if err != nil {
		return defaultValue, err
	}
	if result, ok := value.(string); ok {
		return result, nil
	}
	return defaultValue, &ValueTypeError{key: key, value: value, message: "Value is not a string."}
}
301253
func ConvertKeysToStrings(item interface{}) interface{} {
	switch typedDatas := item.(type) {
	case map[string]interface{}:
		for key, value := range typedDatas {
			typedDatas[key] = ConvertKeysToStrings(value)
		}
		return typedDatas
	case map[interface{}]interface{}:
		newMap := make(map[string]interface{})
		for key, value := range typedDatas {
			stringKey := key.(string)
			newMap[stringKey] = ConvertKeysToStrings(value)
		}
		return newMap
	case []interface{}:
		for i, value := range typedDatas {
			typedDatas[i] = ConvertKeysToStrings(value)
		}
		return typedDatas
	default:
		return item
	}
}
74381
func (o *ConfigOpt) String() string {
	configs := []string{}
	for _, config := range o.values {
		repr := fmt.Sprintf("%s -> %s", config.ConfigName, config.File.Name)
		configs = append(configs, repr)
	}
	return strings.Join(configs, ", ")
}
988006
func (t Section) ValueType(k string) (ValueType, bool) {
	v, ok := t.values[k]
	return v.Type, ok
}
236925
func ValueToStrings(val Value) ([]string, bool) {
	if val == nil || val.Err() {
		return nil, false
	}
	switch v := val.(type) {
	case StringValue:
		return []string{v.Val()}, true
	case TimeValue:
		return []string{fmt.Sprintf("%v", v.Val())}, true
	case ByteSliceValue:
		return []string{string(v.Val())}, true
	case NumericValue, BoolValue, IntValue:
		return []string{val.ToString()}, true
	case Slice:
		if v.Len() == 0 {
			return nil, false
		}
		vals := make([]string, v.Len())
		for i, val := range v.SliceValue() {
			if val != nil {
				vals[i] = val.ToString()
			}
		}
		return vals, true
	}
	return nil, false
}
1350805
func (mc MongoClient) ValueDescriptorsByType(t string) ([]contract.ValueDescriptor, error) {
	return mapValueDescriptors(mc.getValueDescriptors(bson.M{"type": t}))
}
105638
func (c Config) Features() set.Strings {
	features := set.NewStrings()
	if value, ok := c[Features]; ok {
		value := value.([]interface{})
		for _, item := range value {
			features.Add(item.(string))
		}
	}
	return features
}
102289
func (schema *Schema) arrayOfStringsValue(v interface{}) *[]string {
	switch v := v.(type) {
	default:
		fmt.Printf("arrayOfStringsValue: unexpected type %T\n", v)
	case []string:
		return &v
	case string:
		a := []string{v}
		return &a
	case []interface{}:
		a := make([]string, 0)
		for _, v2 := range v {
			switch v2 := v2.(type) {
			default:
				fmt.Printf("arrayOfStringsValue: unexpected type %T\n", v2)
			case string:
				a = append(a, v2)
			}
		}
		return &a
	}
	return nil
}
1266475
func (rs *ResultSet) KeyValues() (KeyValues, error) {
	kvs := KeyValues{}
	key := ""
	for index, item := range rs.items {
		value, ok := item.(Value)
		if !ok {
			return nil, errors.New(ErrIllegalItemType, errorMessages, index, "value")
		}
		if index%2 == 0 {
			key = value.String()
		} else {
			kvs = append(kvs, KeyValue{key, value})
		}
	}
	return kvs, nil
}
930654
func (d config) String() string {
	configBytes, _ := json.MarshalIndent(d.data, "", "\t")
	return string(configBytes)
}
1078801
func (v *Type) GetKeyValueSliceType() (o *TypePair) {
	if v != nil && v.KeyValueSliceType != nil {
		return v.KeyValueSliceType
	}

	return
}
1279910
func (s *IndicesStatsService) Types(types ...string) *IndicesStatsService {
	s.types = append(s.types, types...)
	return s
}
298855
func (c *ConfigPolicy) getDefaults() Config {
	config := NewConfig()
	for _, v := range c.stringRules {
		for key, val := range v.Rules {
			if val.HasDefault {
				config[key] = val.Default
			}
		}
	}
	for _, v := range c.boolRules {
		for key, val := range v.Rules {
			if val.HasDefault {
				config[key] = val.Default
			}
		}
	}
	for _, v := range c.floatRules {
		for key, val := range v.Rules {
			if val.HasDefault {
				config[key] = val.Default
			}
		}
	}
	for _, v := range c.integerRules {
		for key, val := range v.Rules {
			if val.HasDefault {
				config[key] = val.Default
			}
		}
	}

	return config
}
301828
func (model *Model) modelConfigValues(modelCfg attrValues) (config.ConfigValues, error) {
	resultValues := make(attrValues)
	for k, v := range modelCfg {
		resultValues[k] = v
	}

	// Read all of the current inherited config values so
	// we can dynamically reflect the origin of the model config.
	rspec, err := model.st.regionSpec()
	if err != nil {
		return nil, errors.Trace(err)
	}
	configSources := modelConfigSources(model.st, rspec)
	sourceNames := make([]string, 0, len(configSources))
	sourceAttrs := make([]attrValues, 0, len(configSources))
	for _, src := range configSources {
		sourceNames = append(sourceNames, src.name)
		cfg, err := src.sourceFunc()
		if errors.IsNotFound(err) {
			continue
		}
		if err != nil {
			return nil, errors.Annotatef(err, "reading %s settings", src.name)
		}
		sourceAttrs = append(sourceAttrs, cfg)

		// If no modelCfg was passed in, we'll accumulate data
		// for the inherited values instead.
		if len(modelCfg) == 0 {
			for k, v := range cfg {
				resultValues[k] = v
			}
		}
	}

	// Figure out the source of each config attribute based
	// on the current model values and the inherited values.
	result := make(config.ConfigValues)
	for attr, val := range resultValues {
		// Find the source of config for which the model
		// value matches. If there's a match, the last match
		// in the search order will be the source of config.
		// If there's no match, the source is the model.
		source := config.JujuModelConfigSource
		n := len(sourceAttrs)
		for i := range sourceAttrs {
			if sourceAttrs[n-i-1][attr] == val {
				source = sourceNames[n-i-1]
				break
			}
		}
		result[attr] = config.ConfigValue{
			Value:  val,
			Source: source,
		}
	}
	return result, nil
}
1154340
func (model *Model) ModelConfigValues() (config.ConfigValues, error) {
	cfg, err := model.ModelConfig()
	if err != nil {
		return nil, errors.Trace(err)
	}
	return model.modelConfigValues(cfg.AllAttrs())
}
976444
func getConfigItemValue(item ctypes.ConfigValue) (interface{}, error) {

	var value interface{}

	switch item.Type() {
	case "string":
		value = item.(ctypes.ConfigValueStr).Value
		break

	case "float":
		value = item.(ctypes.ConfigValueFloat).Value
		break

	case "integer":
		value = item.(ctypes.ConfigValueInt).Value
		break

	case "bool":
		value = item.(ctypes.ConfigValueBool).Value
		break

	default:
		return nil, fmt.Errorf("Unsupported type of configuration item, type=%v", item.Type())
	}

	return value, nil
}