// NewStorage returns a RESTStorage object that will work against Build objects. func NewREST(optsGetter restoptions.Getter) (*REST, *DetailsREST, error) { prefix := "/builds" store := ®istry.Store{ NewFunc: func() runtime.Object { return &api.Build{} }, NewListFunc: func() runtime.Object { return &api.BuildList{} }, QualifiedResource: api.Resource("builds"), KeyRootFunc: func(ctx kapi.Context) string { return registry.NamespaceKeyRootFunc(ctx, prefix) }, KeyFunc: func(ctx kapi.Context, id string) (string, error) { return registry.NamespaceKeyFunc(ctx, prefix, id) }, ObjectNameFunc: func(obj runtime.Object) (string, error) { return obj.(*api.Build).Name, nil }, PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher { return build.Matcher(label, field) }, CreateStrategy: build.Strategy, UpdateStrategy: build.Strategy, DeleteStrategy: build.Strategy, Decorator: build.Decorator, ReturnDeletedObject: false, } if err := restoptions.ApplyOptions(optsGetter, store, prefix); err != nil { return nil, nil, err } detailsStore := *store detailsStore.UpdateStrategy = build.DetailsStrategy return &REST{store}, &DetailsREST{&detailsStore}, nil }
// NewStorage returns a RESTStorage object that will work against Build objects. func NewREST(s storage.Interface) (*REST, *DetailsREST) { prefix := "/builds" store := &etcdgeneric.Etcd{ NewFunc: func() runtime.Object { return &api.Build{} }, NewListFunc: func() runtime.Object { return &api.BuildList{} }, QualifiedResource: api.Resource("builds"), KeyRootFunc: func(ctx kapi.Context) string { return etcdgeneric.NamespaceKeyRootFunc(ctx, prefix) }, KeyFunc: func(ctx kapi.Context, id string) (string, error) { return etcdgeneric.NamespaceKeyFunc(ctx, prefix, id) }, ObjectNameFunc: func(obj runtime.Object) (string, error) { return obj.(*api.Build).Name, nil }, PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher { return build.Matcher(label, field) }, CreateStrategy: build.Strategy, UpdateStrategy: build.Strategy, DeleteStrategy: build.Strategy, Decorator: build.Decorator, ReturnDeletedObject: false, Storage: s, } detailsStore := *store detailsStore.UpdateStrategy = build.DetailsStrategy return &REST{store}, &DetailsREST{&detailsStore} }
// NewStorage returns a RESTStorage object that will work against Build objects. func NewStorage(s storage.Interface) (buildStorage *REST, detailsStorage *DetailsREST) { store := &etcdgeneric.Etcd{ NewFunc: func() runtime.Object { return &api.Build{} }, NewListFunc: func() runtime.Object { return &api.BuildList{} }, EndpointName: "build", KeyRootFunc: func(ctx kapi.Context) string { return etcdgeneric.NamespaceKeyRootFunc(ctx, BuildPath) }, KeyFunc: func(ctx kapi.Context, id string) (string, error) { return etcdgeneric.NamespaceKeyFunc(ctx, BuildPath, id) }, ObjectNameFunc: func(obj runtime.Object) (string, error) { return obj.(*api.Build).Name, nil }, PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher { return build.Matcher(label, field) }, CreateStrategy: build.Strategy, UpdateStrategy: build.Strategy, DeleteStrategy: build.Strategy, Decorator: build.Decorator, ReturnDeletedObject: false, Storage: s, } buildStorage = &REST{store} detailsStore := *store detailsStore.UpdateStrategy = build.DetailsStrategy detailsStorage = &DetailsREST{&detailsStore} return }
// NewREST returns a RESTStorage object that will work against Build objects. func NewREST(optsGetter restoptions.Getter) (*REST, *DetailsREST, error) { store := ®istry.Store{ NewFunc: func() runtime.Object { return &api.Build{} }, NewListFunc: func() runtime.Object { return &api.BuildList{} }, QualifiedResource: api.Resource("builds"), ObjectNameFunc: func(obj runtime.Object) (string, error) { return obj.(*api.Build).Name, nil }, PredicateFunc: func(label labels.Selector, field fields.Selector) *generic.SelectionPredicate { return build.Matcher(label, field) }, CreateStrategy: build.Strategy, UpdateStrategy: build.Strategy, DeleteStrategy: build.Strategy, Decorator: build.Decorator, ReturnDeletedObject: false, } if err := restoptions.ApplyOptions(optsGetter, store, true, storage.NoTriggerPublisher); err != nil { return nil, nil, err } detailsStore := *store detailsStore.UpdateStrategy = build.DetailsStrategy return &REST{store}, &DetailsREST{&detailsStore}, nil }
// NewStorage returns a RESTStorage object that will work against Build objects. func NewStorage(h tools.EtcdHelper) *REST { store := &etcdgeneric.Etcd{ NewFunc: func() runtime.Object { return &api.Build{} }, NewListFunc: func() runtime.Object { return &api.BuildList{} }, EndpointName: "build", KeyRootFunc: func(ctx kapi.Context) string { return etcdgeneric.NamespaceKeyRootFunc(ctx, BuildPath) }, KeyFunc: func(ctx kapi.Context, id string) (string, error) { return etcdgeneric.NamespaceKeyFunc(ctx, BuildPath, id) }, ObjectNameFunc: func(obj runtime.Object) (string, error) { return obj.(*api.Build).Name, nil }, PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher { return build.Matcher(label, field) }, CreateStrategy: build.Strategy, UpdateStrategy: build.Strategy, DeleteStrategy: build.Strategy, Decorator: build.Decorator, ReturnDeletedObject: false, Helper: h, } return &REST{store} }