compute query parameter names in the client.

This commit is contained in:
Daniel Smith
2015-04-06 16:54:26 -07:00
parent 0e10b2a842
commit 44bc29631e
19 changed files with 91 additions and 70 deletions

View File

@@ -17,7 +17,6 @@ limitations under the License.
package cache
import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/fields"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
@@ -41,10 +40,20 @@ type ListWatch struct {
// 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 {
listFunc := func() (runtime.Object, error) {
return c.Get().Namespace(namespace).Resource(resource).FieldsSelectorParam(api.FieldSelectorQueryParam(c.APIVersion()), fieldSelector).Do().Get()
return c.Get().
Namespace(namespace).
Resource(resource).
FieldsSelectorParam(fieldSelector).
Do().
Get()
}
watchFunc := func(resourceVersion string) (watch.Interface, error) {
return c.Get().Prefix("watch").Namespace(namespace).Resource(resource).FieldsSelectorParam(api.FieldSelectorQueryParam(c.APIVersion()), fieldSelector).Param("resourceVersion", resourceVersion).Watch()
return c.Get().
Prefix("watch").
Namespace(namespace).
Resource(resource).
FieldsSelectorParam(fieldSelector).
Param("resourceVersion", resourceVersion).Watch()
}
return &ListWatch{ListFunc: listFunc, WatchFunc: watchFunc}
}