Unify List() signature in clients

This commit is contained in:
Wojciech Tyczynski
2015-10-30 15:35:22 +01:00
parent cc53619372
commit aac55d4795
8 changed files with 13 additions and 11 deletions

View File

@@ -33,7 +33,7 @@ type EndpointsNamespacer interface {
// EndpointsInterface has methods to work with Endpoints resources
type EndpointsInterface interface {
Create(endpoints *api.Endpoints) (*api.Endpoints, error)
List(selector labels.Selector) (*api.EndpointsList, error)
List(label labels.Selector, field fields.Selector) (*api.EndpointsList, error)
Get(name string) (*api.Endpoints, error)
Delete(name string) error
Update(endpoints *api.Endpoints) (*api.Endpoints, error)
@@ -59,12 +59,13 @@ func (c *endpoints) Create(endpoints *api.Endpoints) (*api.Endpoints, error) {
}
// List takes a selector, and returns the list of endpoints that match that selector
func (c *endpoints) List(selector labels.Selector) (result *api.EndpointsList, err error) {
func (c *endpoints) List(label labels.Selector, field fields.Selector) (result *api.EndpointsList, err error) {
result = &api.EndpointsList{}
err = c.r.Get().
Namespace(c.ns).
Resource("endpoints").
LabelsSelectorParam(selector).
LabelsSelectorParam(label).
FieldsSelectorParam(field).
Do().
Into(result)
return