Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Vault
Commits
937d4d49
Commit
937d4d49
authored
4 years ago
by
Nick Cabatoff
Browse files
Options
Download
Email Patches
Plain Diff
Add TypeAny which is just interface{}.
parent
52d70a46
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
sdk/framework/field_data.go
+5
-2
sdk/framework/field_data.go
sdk/framework/field_type.go
+4
-0
sdk/framework/field_type.go
vendor/github.com/hashicorp/vault/sdk/framework/field_data.go
+4
-1
...or/github.com/hashicorp/vault/sdk/framework/field_data.go
vendor/github.com/hashicorp/vault/sdk/framework/field_type.go
+4
-0
...or/github.com/hashicorp/vault/sdk/framework/field_type.go
with
17 additions
and
3 deletions
+17
-3
sdk/framework/field_data.go
+
5
-
2
View file @
937d4d49
...
...
@@ -40,7 +40,7 @@ func (d *FieldData) Validate() error {
switch
schema
.
Type
{
case
TypeBool
,
TypeInt
,
TypeMap
,
TypeDurationSecond
,
TypeSignedDurationSecond
,
TypeString
,
TypeLowerCaseString
,
TypeNameString
,
TypeSlice
,
TypeStringSlice
,
TypeCommaStringSlice
,
TypeKVPairs
,
TypeCommaIntSlice
,
TypeHeader
,
TypeFloat
,
TypeTime
:
TypeKVPairs
,
TypeCommaIntSlice
,
TypeHeader
,
TypeFloat
,
TypeTime
,
TypeAny
:
_
,
_
,
err
:=
d
.
getPrimitive
(
field
,
schema
)
if
err
!=
nil
{
return
errwrap
.
Wrapf
(
fmt
.
Sprintf
(
"error converting input %v for field %q: {{err}}"
,
value
,
field
),
err
)
...
...
@@ -131,7 +131,7 @@ func (d *FieldData) GetOkErr(k string) (interface{}, bool, error) {
}
switch
schema
.
Type
{
case
TypeBool
,
TypeInt
,
TypeMap
,
TypeDurationSecond
,
TypeSignedDurationSecond
,
TypeString
,
case
TypeAny
,
TypeBool
,
TypeInt
,
TypeMap
,
TypeDurationSecond
,
TypeSignedDurationSecond
,
TypeString
,
TypeLowerCaseString
,
TypeNameString
,
TypeSlice
,
TypeStringSlice
,
TypeCommaStringSlice
,
TypeKVPairs
,
TypeCommaIntSlice
,
TypeHeader
,
TypeFloat
,
TypeTime
:
return
d
.
getPrimitive
(
k
,
schema
)
...
...
@@ -148,6 +148,9 @@ func (d *FieldData) getPrimitive(k string, schema *FieldSchema) (interface{}, bo
}
switch
t
:=
schema
.
Type
;
t
{
case
TypeAny
:
return
raw
,
true
,
nil
case
TypeBool
:
var
result
bool
if
err
:=
mapstructure
.
WeakDecode
(
raw
,
&
result
);
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
sdk/framework/field_type.go
+
4
-
0
View file @
937d4d49
...
...
@@ -62,6 +62,8 @@ const (
// formatted as a string or a number. The resulting time.Time
// is converted to UTC.
TypeTime
TypeAny
)
func
(
t
FieldType
)
String
()
string
{
...
...
@@ -90,6 +92,8 @@ func (t FieldType) String() string {
return
"float"
case
TypeTime
:
return
"time"
case
TypeAny
:
return
"any"
default
:
return
"unknown type"
}
...
...
This diff is collapsed.
Click to expand it.
vendor/github.com/hashicorp/vault/sdk/framework/field_data.go
+
4
-
1
View file @
937d4d49
...
...
@@ -40,7 +40,7 @@ func (d *FieldData) Validate() error {
switch
schema
.
Type
{
case
TypeBool
,
TypeInt
,
TypeMap
,
TypeDurationSecond
,
TypeSignedDurationSecond
,
TypeString
,
TypeLowerCaseString
,
TypeNameString
,
TypeSlice
,
TypeStringSlice
,
TypeCommaStringSlice
,
TypeKVPairs
,
TypeCommaIntSlice
,
TypeHeader
,
TypeFloat
,
TypeTime
:
TypeKVPairs
,
TypeCommaIntSlice
,
TypeHeader
,
TypeFloat
,
TypeTime
,
TypeAny
:
_
,
_
,
err
:=
d
.
getPrimitive
(
field
,
schema
)
if
err
!=
nil
{
return
errwrap
.
Wrapf
(
fmt
.
Sprintf
(
"error converting input %v for field %q: {{err}}"
,
value
,
field
),
err
)
...
...
@@ -148,6 +148,9 @@ func (d *FieldData) getPrimitive(k string, schema *FieldSchema) (interface{}, bo
}
switch
t
:=
schema
.
Type
;
t
{
case
TypeAny
:
return
raw
,
true
,
nil
case
TypeBool
:
var
result
bool
if
err
:=
mapstructure
.
WeakDecode
(
raw
,
&
result
);
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
vendor/github.com/hashicorp/vault/sdk/framework/field_type.go
+
4
-
0
View file @
937d4d49
...
...
@@ -62,6 +62,8 @@ const (
// formatted as a string or a number. The resulting time.Time
// is converted to UTC.
TypeTime
TypeAny
)
func
(
t
FieldType
)
String
()
string
{
...
...
@@ -90,6 +92,8 @@ func (t FieldType) String() string {
return
"float"
case
TypeTime
:
return
"time"
case
TypeAny
:
return
"any"
default
:
return
"unknown type"
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help