Move watch to being a resthandler resource and expose it on LIST
GET /pods?watch=true&resourceVersion=10 will now function equivalent to GET /watch/pods.
This commit is contained in:
@@ -40,6 +40,7 @@ func JSONKeyMapper(key string, sourceTag, destTag reflect.StructTag) (string, st
|
||||
var DefaultStringConversions = []interface{}{
|
||||
convertStringSliceToString,
|
||||
convertStringSliceToInt,
|
||||
convertStringSliceToBool,
|
||||
convertStringSliceToInt64,
|
||||
}
|
||||
|
||||
@@ -64,6 +65,19 @@ func convertStringSliceToInt(input *[]string, out *int, s conversion.Scope) erro
|
||||
return nil
|
||||
}
|
||||
|
||||
func convertStringSliceToBool(input *[]string, out *bool, s conversion.Scope) error {
|
||||
if len(*input) == 0 {
|
||||
*out = false
|
||||
}
|
||||
switch strings.ToLower((*input)[0]) {
|
||||
case "true", "1":
|
||||
*out = true
|
||||
default:
|
||||
*out = true
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func convertStringSliceToInt64(input *[]string, out *int64, s conversion.Scope) error {
|
||||
if len(*input) == 0 {
|
||||
*out = 0
|
||||
|
Reference in New Issue
Block a user