// NewREST returns a RESTStorage object that will work against netnamespaces func NewREST(s storage.Interface) *REST { store := &etcdgeneric.Etcd{ NewFunc: func() runtime.Object { return &api.NetNamespace{} }, NewListFunc: func() runtime.Object { return &api.NetNamespaceList{} }, KeyRootFunc: func(ctx kapi.Context) string { return etcdPrefix }, KeyFunc: func(ctx kapi.Context, name string) (string, error) { return etcdgeneric.NoNamespaceKeyFunc(ctx, etcdPrefix, name) }, ObjectNameFunc: func(obj runtime.Object) (string, error) { return obj.(*api.NetNamespace).NetName, nil }, PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher { return netnamespace.Matcher(label, field) }, EndpointName: "netnamespace", Storage: s, } store.CreateStrategy = netnamespace.Strategy store.UpdateStrategy = netnamespace.Strategy return &REST{*store} }
// NewREST returns a RESTStorage object that will work against netnamespaces func NewREST(optsGetter restoptions.Getter) (*REST, error) { store := ®istry.Store{ NewFunc: func() runtime.Object { return &api.NetNamespace{} }, NewListFunc: func() runtime.Object { return &api.NetNamespaceList{} }, KeyRootFunc: func(ctx kapi.Context) string { return etcdPrefix }, KeyFunc: func(ctx kapi.Context, name string) (string, error) { return registry.NoNamespaceKeyFunc(ctx, etcdPrefix, name) }, ObjectNameFunc: func(obj runtime.Object) (string, error) { return obj.(*api.NetNamespace).NetName, nil }, PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher { return netnamespace.Matcher(label, field) }, QualifiedResource: api.Resource("netnamespaces"), CreateStrategy: netnamespace.Strategy, UpdateStrategy: netnamespace.Strategy, } if err := restoptions.ApplyOptions(optsGetter, store, etcdPrefix); err != nil { return nil, err } return &REST{*store}, nil }
// NewREST returns a RESTStorage object that will work against netnamespaces func NewREST(optsGetter restoptions.Getter) (*REST, error) { store := ®istry.Store{ NewFunc: func() runtime.Object { return &api.NetNamespace{} }, NewListFunc: func() runtime.Object { return &api.NetNamespaceList{} }, ObjectNameFunc: func(obj runtime.Object) (string, error) { return obj.(*api.NetNamespace).NetName, nil }, PredicateFunc: func(label labels.Selector, field fields.Selector) storage.SelectionPredicate { return netnamespace.Matcher(label, field) }, QualifiedResource: api.Resource("netnamespaces"), CreateStrategy: netnamespace.Strategy, UpdateStrategy: netnamespace.Strategy, } if err := restoptions.ApplyOptions(optsGetter, store, false, storage.NoTriggerPublisher); err != nil { return nil, err } return &REST{*store}, nil }