Add context object to interfaces

This commit is contained in:
derekwaynecarr
2014-09-25 14:34:01 -04:00
parent 377a9ac3d7
commit 3e685674e7
15 changed files with 115 additions and 63 deletions

View File

@@ -19,6 +19,8 @@ package binding
import (
"fmt"
"code.google.com/p/go.net/context"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors"
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver"
@@ -41,17 +43,17 @@ func NewREST(bindingRegistry Registry) *REST {
}
// List returns an error because bindings are write-only objects.
func (*REST) List(label, field labels.Selector) (runtime.Object, error) {
func (*REST) List(ctx context.Context, label, field labels.Selector) (runtime.Object, error) {
return nil, errors.NewNotFound("binding", "list")
}
// Get returns an error because bindings are write-only objects.
func (*REST) Get(id string) (runtime.Object, error) {
func (*REST) Get(ctx context.Context, id string) (runtime.Object, error) {
return nil, errors.NewNotFound("binding", id)
}
// Delete returns an error because bindings are write-only objects.
func (*REST) Delete(id string) (<-chan runtime.Object, error) {
func (*REST) Delete(ctx context.Context, id string) (<-chan runtime.Object, error) {
return nil, errors.NewNotFound("binding", id)
}
@@ -61,7 +63,7 @@ func (*REST) New() runtime.Object {
}
// Create attempts to make the assignment indicated by the binding it recieves.
func (b *REST) Create(obj runtime.Object) (<-chan runtime.Object, error) {
func (b *REST) Create(ctx context.Context, obj runtime.Object) (<-chan runtime.Object, error) {
binding, ok := obj.(*api.Binding)
if !ok {
return nil, fmt.Errorf("incorrect type: %#v", obj)
@@ -75,6 +77,6 @@ func (b *REST) Create(obj runtime.Object) (<-chan runtime.Object, error) {
}
// Update returns an error-- this object may not be updated.
func (b *REST) Update(obj runtime.Object) (<-chan runtime.Object, error) {
func (b *REST) Update(ctx context.Context, obj runtime.Object) (<-chan runtime.Object, error) {
return nil, fmt.Errorf("Bindings may not be changed.")
}