// NewREST returns a RESTStorage object that will work against subnets func NewREST(s storage.Interface) *REST { store := &etcdgeneric.Etcd{ NewFunc: func() runtime.Object { return &api.ClusterNetwork{} }, NewListFunc: func() runtime.Object { return &api.ClusterNetworkList{} }, 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.ClusterNetwork).Name, nil }, PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher { return clusternetwork.Matcher(label, field) }, EndpointName: "clusternetwork", Storage: s, } store.CreateStrategy = clusternetwork.Strategy store.UpdateStrategy = clusternetwork.Strategy return &REST{*store} }
// NewREST returns a RESTStorage object that will work against subnets func NewREST(optsGetter restoptions.Getter) (*REST, error) { store := ®istry.Store{ NewFunc: func() runtime.Object { return &api.ClusterNetwork{} }, NewListFunc: func() runtime.Object { return &api.ClusterNetworkList{} }, 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.ClusterNetwork).Name, nil }, PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher { return clusternetwork.Matcher(label, field) }, QualifiedResource: api.Resource("clusternetworks"), CreateStrategy: clusternetwork.Strategy, UpdateStrategy: clusternetwork.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 subnets func NewREST(optsGetter restoptions.Getter) (*REST, error) { store := ®istry.Store{ NewFunc: func() runtime.Object { return &api.ClusterNetwork{} }, NewListFunc: func() runtime.Object { return &api.ClusterNetworkList{} }, ObjectNameFunc: func(obj runtime.Object) (string, error) { return obj.(*api.ClusterNetwork).Name, nil }, PredicateFunc: func(label labels.Selector, field fields.Selector) storage.SelectionPredicate { return clusternetwork.Matcher(label, field) }, QualifiedResource: api.Resource("clusternetworks"), CreateStrategy: clusternetwork.Strategy, UpdateStrategy: clusternetwork.Strategy, } if err := restoptions.ApplyOptions(optsGetter, store, false, storage.NoTriggerPublisher); err != nil { return nil, err } return &REST{*store}, nil }