Merge pull request #12795 from soltysh/list_watch_client

Allow using NewListWatchFromClient from other client implementation
This commit is contained in:
Marek Grabowski 2015-08-17 16:15:57 +02:00
commit 45007431bc

View File

@ -37,8 +37,13 @@ type ListWatch struct {
WatchFunc WatchFunc
}
// Getter interface knows how to access Get method from RESTClient.
type Getter interface {
Get() *client.Request
}
// NewListWatchFromClient creates a new ListWatch from the specified client, resource, namespace and field selector.
func NewListWatchFromClient(c *client.Client, resource string, namespace string, fieldSelector fields.Selector) *ListWatch {
func NewListWatchFromClient(c Getter, resource string, namespace string, fieldSelector fields.Selector) *ListWatch {
listFunc := func() (runtime.Object, error) {
return c.Get().
Namespace(namespace).