diff --git a/logical/framework/backend.go b/logical/framework/backend.go index fc73b5fac777..ce4fb91d38f3 100644 --- a/logical/framework/backend.go +++ b/logical/framework/backend.go @@ -612,7 +612,7 @@ func (t FieldType) Zero() interface{} { return false case TypeMap: return map[string]interface{}{} - case TypeKeyPairs: + case TypeKVPairs: return map[string]string{} case TypeDurationSecond: return 0 diff --git a/logical/framework/field_data.go b/logical/framework/field_data.go index 96daba69dfe1..1d03c335e8d6 100644 --- a/logical/framework/field_data.go +++ b/logical/framework/field_data.go @@ -36,7 +36,7 @@ func (d *FieldData) Validate() error { switch schema.Type { case TypeBool, TypeInt, TypeMap, TypeDurationSecond, TypeString, TypeNameString, TypeSlice, TypeStringSlice, TypeCommaStringSlice, - TypeKeyPairs: + TypeKVPairs: _, _, err := d.getPrimitive(field, schema) if err != nil { return fmt.Errorf("Error converting input %v for field %s: %s", value, field, err) @@ -113,7 +113,7 @@ func (d *FieldData) GetOkErr(k string) (interface{}, bool, error) { switch schema.Type { case TypeBool, TypeInt, TypeMap, TypeDurationSecond, TypeString, TypeNameString, TypeSlice, TypeStringSlice, TypeCommaStringSlice, - TypeKeyPairs: + TypeKVPairs: return d.getPrimitive(k, schema) default: return nil, false, @@ -239,7 +239,7 @@ func (d *FieldData) getPrimitive( } return strutil.TrimStrings(result), true, nil - case TypeKeyPairs: + case TypeKVPairs: // First try to parse this as a map var mapResult map[string]string if err := mapstructure.WeakDecode(raw, &mapResult); err == nil { diff --git a/logical/framework/field_data_test.go b/logical/framework/field_data_test.go index feae57e3a1f9..24a435f1a2c0 100644 --- a/logical/framework/field_data_test.go +++ b/logical/framework/field_data_test.go @@ -281,7 +281,7 @@ func TestFieldDataGet(t *testing.T) { "keypair type, valid value map type": { map[string]*FieldSchema{ - "foo": &FieldSchema{Type: TypeKeyPairs}, + "foo": &FieldSchema{Type: TypeKVPairs}, }, map[string]interface{}{ "foo": map[string]interface{}{ @@ -300,7 +300,7 @@ func TestFieldDataGet(t *testing.T) { "keypair type, list of equal sign delim key pairs type": { map[string]*FieldSchema{ - "foo": &FieldSchema{Type: TypeKeyPairs}, + "foo": &FieldSchema{Type: TypeKVPairs}, }, map[string]interface{}{ "foo": []interface{}{"key1=value1", "key2=value2", "key3=1"}, @@ -315,7 +315,7 @@ func TestFieldDataGet(t *testing.T) { "keypair type, single equal sign delim value": { map[string]*FieldSchema{ - "foo": &FieldSchema{Type: TypeKeyPairs}, + "foo": &FieldSchema{Type: TypeKVPairs}, }, map[string]interface{}{ "foo": "key1=value1", @@ -390,7 +390,7 @@ func TestFieldDataGet_Error(t *testing.T) { }, "keypair type, csv version empty key name": { map[string]*FieldSchema{ - "foo": &FieldSchema{Type: TypeKeyPairs}, + "foo": &FieldSchema{Type: TypeKVPairs}, }, map[string]interface{}{ "foo": []interface{}{"=value1", "key2=value2", "key3=1"}, diff --git a/logical/framework/field_type.go b/logical/framework/field_type.go index 04e149f31b05..f18e442ba7e4 100644 --- a/logical/framework/field_type.go +++ b/logical/framework/field_type.go @@ -31,9 +31,9 @@ const ( // character and characters in the middle can be alphanumeric or . or -. TypeNameString - // TypeKeyPairs allows you to represent the data as a map or a list of + // TypeKVPairs allows you to represent the data as a map or a list of // equal sign delimited key pairs - TypeKeyPairs + TypeKVPairs ) func (t FieldType) String() string { @@ -48,7 +48,7 @@ func (t FieldType) String() string { return "bool" case TypeMap: return "map" - case TypeKeyPairs: + case TypeKVPairs: return "keypair" case TypeDurationSecond: return "duration (sec)"