Use codec to encode/decode api objects in client and kubecfg parser

The purpose of this change is to allow core parser and client to work with other resource codecs that know how to encode/decode custom types.
In this case it's an interface that clients need to use in order to create a NewRestClient which is public.  Actually our stance has been that this should then be a public interface anyway.