summaryrefslogtreecommitdiff
path: root/pkg/bindings/util
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-02-18 11:13:31 -0500
committerGitHub <noreply@github.com>2021-02-18 11:13:31 -0500
commitb2bb05d598452f7653e5b9311e3bd844b767cb26 (patch)
tree9a86f5fd20924b275ecc45c3b8480804e6b5258b /pkg/bindings/util
parentc3419d2168415cb3e6f1349afaa9c04c29cbb933 (diff)
parente022c19753182cfb85f8f49354d493ee3a3147a3 (diff)
downloadpodman-b2bb05d598452f7653e5b9311e3bd844b767cb26.tar.gz
podman-b2bb05d598452f7653e5b9311e3bd844b767cb26.tar.bz2
podman-b2bb05d598452f7653e5b9311e3bd844b767cb26.zip
Merge pull request #9414 from edigaryev/fix-wait-api-condition
API: fix libpod's container wait endpoint condition conversion
Diffstat (limited to 'pkg/bindings/util')
-rw-r--r--pkg/bindings/util/util.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/bindings/util/util.go b/pkg/bindings/util/util.go
index 6296fc22f..c1961308e 100644
--- a/pkg/bindings/util/util.go
+++ b/pkg/bindings/util/util.go
@@ -2,6 +2,7 @@ package util
import (
"errors"
+ "fmt"
"net/url"
"reflect"
"strconv"
@@ -11,14 +12,23 @@ import (
)
func IsSimpleType(f reflect.Value) bool {
+ if _, ok := f.Interface().(fmt.Stringer); ok {
+ return true
+ }
+
switch f.Kind() {
case reflect.Bool, reflect.Int, reflect.Int64, reflect.Uint, reflect.Uint64, reflect.String:
return true
}
+
return false
}
func SimpleTypeToParam(f reflect.Value) string {
+ if s, ok := f.Interface().(fmt.Stringer); ok {
+ return s.String()
+ }
+
switch f.Kind() {
case reflect.Bool:
return strconv.FormatBool(f.Bool())
@@ -31,6 +41,7 @@ func SimpleTypeToParam(f reflect.Value) string {
case reflect.String:
return f.String()
}
+
panic("the input parameter is not a simple type")
}