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:
Clayton Coleman
2015-03-24 00:07:22 -04:00
parent 1618c39a46
commit eb0eff69fe
11 changed files with 116 additions and 176 deletions

View File

@@ -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