mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Allow other client's implementation to reuse NewListWatchFromClient by passing in the Getter interface, responsible for accessing RESTClient's Get method.
This commit is contained in:
parent
e9dd3c5543
commit
686f764fc7
7
pkg/client/cache/listwatch.go
vendored
7
pkg/client/cache/listwatch.go
vendored
@ -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).
|
||||
|
Loading…
Reference in New Issue
Block a user