Skip to content

Commit

Permalink
TypeKeyPairs -> TypeKVPairs
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Hoffman committed Nov 6, 2017
1 parent e1e5d48 commit 9e6210a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion logical/framework/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions logical/framework/field_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions logical/framework/field_data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}{
Expand All @@ -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"},
Expand All @@ -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",
Expand Down Expand Up @@ -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"},
Expand Down
6 changes: 3 additions & 3 deletions logical/framework/field_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)"
Expand Down

0 comments on commit 9e6210a

Please sign in to comment.