Commit 686f764f authored by Maciej Szulik's avatar Maciej Szulik

Allow other client's implementation to reuse NewListWatchFromClient by passing…

Allow other client's implementation to reuse NewListWatchFromClient by passing in the Getter interface, responsible for accessing RESTClient's Get method.
parent e9dd3c55
...@@ -37,8 +37,13 @@ type ListWatch struct { ...@@ -37,8 +37,13 @@ type ListWatch struct {
WatchFunc WatchFunc 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. // 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) { listFunc := func() (runtime.Object, error) {
return c.Get(). return c.Get().
Namespace(namespace). Namespace(namespace).
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment