diff --git a/pkg/client/endpoints.go b/pkg/client/endpoints.go index a3684468fb8..ce634a3cb22 100644 --- a/pkg/client/endpoints.go +++ b/pkg/client/endpoints.go @@ -35,6 +35,7 @@ type EndpointsInterface interface { Create(endpoints *api.Endpoints) (*api.Endpoints, error) List(selector labels.Selector) (*api.EndpointsList, error) Get(name string) (*api.Endpoints, error) + Delete(name string) error Update(endpoints *api.Endpoints) (*api.Endpoints, error) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) } @@ -76,6 +77,11 @@ func (c *endpoints) Get(name string) (result *api.Endpoints, err error) { return } +// Delete takes the name of the endpoint, and returns an error if one occurs +func (c *endpoints) Delete(name string) error { + return c.r.Delete().Namespace(c.ns).Resource("endpoints").Name(name).Do().Error() +} + // Watch returns a watch.Interface that watches the requested endpoints for a service. func (c *endpoints) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { return c.r.Get(). diff --git a/pkg/client/testclient/fake_endpoints.go b/pkg/client/testclient/fake_endpoints.go index 617b9f757bd..891dc9664ad 100644 --- a/pkg/client/testclient/fake_endpoints.go +++ b/pkg/client/testclient/fake_endpoints.go @@ -45,6 +45,11 @@ func (c *FakeEndpoints) Get(name string) (*api.Endpoints, error) { return obj.(*api.Endpoints), err } +func (c *FakeEndpoints) Delete(name string) error { + _, err := c.Fake.Invokes(FakeAction{Action: "delete-endpoints", Value: name}, &api.Endpoints{}) + return err +} + func (c *FakeEndpoints) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { c.Fake.Actions = append(c.Fake.Actions, FakeAction{Action: "watch-endpoints", Value: resourceVersion}) return c.Fake.Watch, c.Fake.Err