Add a subbindings resource as /pods/{name}/binding

Allows POST to create a binding as a child. Also refactors internal
and v1beta3 Binding to be more generic (so that other resources can
support Bindings).
This commit is contained in:
Clayton Coleman
2015-03-04 15:55:41 -05:00
parent 227a1d306d
commit dfc19185f5
19 changed files with 175 additions and 255 deletions

View File

@@ -36,6 +36,8 @@ type PodInterface interface {
Delete(name string) error
Create(pod *api.Pod) (*api.Pod, error)
Update(pod *api.Pod) (*api.Pod, error)
Bind(binding *api.Binding) error
}
// pods implements PodsNamespacer interface
@@ -92,3 +94,8 @@ func (c *pods) Update(pod *api.Pod) (result *api.Pod, err error) {
err = c.r.Put().Namespace(c.ns).Resource("pods").Name(pod.Name).Body(pod).Do().Into(result)
return
}
// Bind applies the provided binding to the named pod in the current namespace (binding.Namespace is ignored).
func (c *pods) Bind(binding *api.Binding) error {
return c.r.Post().Namespace(c.ns).Resource("pods").Name(binding.Name).SubResource("binding").Body(binding).Do().Error()
}