// NewStorage returns a RESTStorage object that will work against nodes. func NewStorage(h tools.EtcdHelper) *REST { store := &etcdgeneric.Etcd{ NewFunc: func() runtime.Object { return &authorizationapi.ClusterPolicyBinding{} }, NewListFunc: func() runtime.Object { return &authorizationapi.ClusterPolicyBindingList{} }, EndpointName: "clusterpolicybinding", KeyRootFunc: func(ctx kapi.Context) string { return ClusterPolicyBindingPath }, KeyFunc: func(ctx kapi.Context, id string) (string, error) { return util.NoNamespaceKeyFunc(ctx, ClusterPolicyBindingPath, id) }, ObjectNameFunc: func(obj runtime.Object) (string, error) { return obj.(*authorizationapi.ClusterPolicyBinding).Name, nil }, PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher { return clusterpolicybinding.Matcher(label, field) }, CreateStrategy: clusterpolicybinding.Strategy, UpdateStrategy: clusterpolicybinding.Strategy, Helper: h, } return &REST{store} }
// NewStorage returns a RESTStorage object that will work against nodes. func NewStorage(optsGetter restoptions.Getter) (*REST, error) { store := ®istry.Store{ NewFunc: func() runtime.Object { return &authorizationapi.ClusterPolicyBinding{} }, NewListFunc: func() runtime.Object { return &authorizationapi.ClusterPolicyBindingList{} }, QualifiedResource: authorizationapi.Resource("clusterpolicybindings"), KeyRootFunc: func(ctx kapi.Context) string { return ClusterPolicyBindingPath }, KeyFunc: func(ctx kapi.Context, id string) (string, error) { return util.NoNamespaceKeyFunc(ctx, ClusterPolicyBindingPath, id) }, ObjectNameFunc: func(obj runtime.Object) (string, error) { return obj.(*authorizationapi.ClusterPolicyBinding).Name, nil }, PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher { return clusterpolicybinding.Matcher(label, field) }, CreateStrategy: clusterpolicybinding.Strategy, UpdateStrategy: clusterpolicybinding.Strategy, } if err := restoptions.ApplyOptions(optsGetter, store, ClusterPolicyBindingPath); err != nil { return nil, err } return &REST{store}, nil }
func (i *InformerToClusterPolicyBindingLister) List(options kapi.ListOptions) (*authorizationapi.ClusterPolicyBindingList, error) { clusterPolicyBindingList := &authorizationapi.ClusterPolicyBindingList{} returnedList := i.GetIndexer().List() matcher := clusterpolicybindingregistry.Matcher(oapi.ListOptionsToSelectors(&options)) for i := range returnedList { clusterPolicyBinding := returnedList[i].(*authorizationapi.ClusterPolicyBinding) if matches, err := matcher.Matches(clusterPolicyBinding); err == nil && matches { clusterPolicyBindingList.Items = append(clusterPolicyBindingList.Items, *clusterPolicyBinding) } } return clusterPolicyBindingList, nil }
func (c *readOnlyClusterPolicyBindingCache) List(options *unversioned.ListOptions) (*authorizationapi.ClusterPolicyBindingList, error) { clusterPolicyBindingList := &authorizationapi.ClusterPolicyBindingList{} returnedList := c.indexer.List() matcher := clusterbindingregistry.Matcher(api.ListOptionsToSelectors(options)) for i := range returnedList { clusterPolicyBinding, castOK := returnedList[i].(*authorizationapi.ClusterPolicyBinding) if !castOK { return clusterPolicyBindingList, errors.NewInvalid("ClusterPolicyBinding", "clusterPolicyBinding", kfield.ErrorList{}) } if matches, err := matcher.Matches(clusterPolicyBinding); err == nil && matches { clusterPolicyBindingList.Items = append(clusterPolicyBindingList.Items, *clusterPolicyBinding) } } return clusterPolicyBindingList, nil }
// NewStorage returns a RESTStorage object that will work against nodes. func NewStorage(optsGetter restoptions.Getter) (*REST, error) { store := ®istry.Store{ NewFunc: func() runtime.Object { return &authorizationapi.ClusterPolicyBinding{} }, NewListFunc: func() runtime.Object { return &authorizationapi.ClusterPolicyBindingList{} }, QualifiedResource: authorizationapi.Resource("clusterpolicybindings"), ObjectNameFunc: func(obj runtime.Object) (string, error) { return obj.(*authorizationapi.ClusterPolicyBinding).Name, nil }, PredicateFunc: func(label labels.Selector, field fields.Selector) *generic.SelectionPredicate { return clusterpolicybinding.Matcher(label, field) }, CreateStrategy: clusterpolicybinding.Strategy, UpdateStrategy: clusterpolicybinding.Strategy, } if err := restoptions.ApplyOptions(optsGetter, store, false, storage.NoTriggerPublisher); err != nil { return nil, err } return &REST{store}, nil }