// 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 "aapi.ClusterResourceQuota{} }, NewListFunc: func() runtime.Object { return "aapi.ClusterResourceQuotaList{} }, QualifiedResource: quotaapi.Resource("clusterresourcequotas"), KeyRootFunc: func(ctx kapi.Context) string { return ClusterResourceQuotaPath }, KeyFunc: func(ctx kapi.Context, id string) (string, error) { return util.NoNamespaceKeyFunc(ctx, ClusterResourceQuotaPath, id) }, ObjectNameFunc: func(obj runtime.Object) (string, error) { return obj.(*quotaapi.ClusterResourceQuota).Name, nil }, PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher { return Matcher(label, field) }, CreateStrategy: Strategy, UpdateStrategy: Strategy, DeleteStrategy: Strategy, ReturnDeletedObject: false, } if err := restoptions.ApplyOptions(optsGetter, store, ClusterResourceQuotaPath); err != nil { return nil, err } return &REST{store}, nil }
// 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 }
// NewREST returns a deploymentConfigREST containing the REST storage for DeploymentConfig objects, // a statusREST containing the REST storage for changing the status of a DeploymentConfig, // and a scaleREST containing the REST storage for the Scale subresources of DeploymentConfigs. func NewREST(optsGetter restoptions.Getter) (*REST, *StatusREST, *ScaleREST, error) { store := ®istry.Store{ NewFunc: func() runtime.Object { return &api.DeploymentConfig{} }, NewListFunc: func() runtime.Object { return &api.DeploymentConfigList{} }, QualifiedResource: api.Resource("deploymentconfigs"), ObjectNameFunc: func(obj runtime.Object) (string, error) { return obj.(*api.DeploymentConfig).Name, nil }, PredicateFunc: func(label labels.Selector, field fields.Selector) storage.SelectionPredicate { return deployconfig.Matcher(label, field) }, CreateStrategy: deployconfig.Strategy, UpdateStrategy: deployconfig.Strategy, DeleteStrategy: deployconfig.Strategy, ReturnDeletedObject: false, } if err := restoptions.ApplyOptions(optsGetter, store, true, storage.NoTriggerPublisher); err != nil { return nil, nil, nil, err } deploymentConfigREST := &REST{store} statusStore := *store statusStore.UpdateStrategy = deployconfig.StatusStrategy statusREST := &StatusREST{store: &statusStore} scaleREST := &ScaleREST{registry: deployconfig.NewRegistry(deploymentConfigREST)} return deploymentConfigREST, statusREST, scaleREST, nil }
// NewREST returns a RESTStorage object that will work against egress network policy func NewREST(optsGetter restoptions.Getter) (*REST, error) { store := ®istry.Store{ NewFunc: func() runtime.Object { return &api.EgressNetworkPolicy{} }, NewListFunc: func() runtime.Object { return &api.EgressNetworkPolicyList{} }, KeyRootFunc: func(ctx kapi.Context) string { return registry.NamespaceKeyRootFunc(ctx, etcdPrefix) }, KeyFunc: func(ctx kapi.Context, name string) (string, error) { return registry.NamespaceKeyFunc(ctx, etcdPrefix, name) }, ObjectNameFunc: func(obj runtime.Object) (string, error) { return obj.(*api.EgressNetworkPolicy).Name, nil }, PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher { return egressnetworkpolicy.Matcher(label, field) }, QualifiedResource: api.Resource("egressnetworkpolicies"), CreateStrategy: egressnetworkpolicy.Strategy, UpdateStrategy: egressnetworkpolicy.Strategy, } if err := restoptions.ApplyOptions(optsGetter, store, etcdPrefix); err != nil { return nil, err } return &REST{*store}, 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.ClusterPolicy{} }, NewListFunc: func() runtime.Object { return &authorizationapi.ClusterPolicyList{} }, QualifiedResource: authorizationapi.Resource("clusterpolicies"), KeyRootFunc: func(ctx kapi.Context) string { return ClusterPolicyPath }, KeyFunc: func(ctx kapi.Context, id string) (string, error) { return util.NoNamespaceKeyFunc(ctx, ClusterPolicyPath, id) }, ObjectNameFunc: func(obj runtime.Object) (string, error) { return obj.(*authorizationapi.ClusterPolicy).Name, nil }, PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher { return clusterpolicy.Matcher(label, field) }, CreateStrategy: clusterpolicy.Strategy, UpdateStrategy: clusterpolicy.Strategy, } if err := restoptions.ApplyOptions(optsGetter, store, ClusterPolicyPath); err != nil { return nil, err } return &REST{store}, nil }
// NewREST returns a RESTStorage object that will work against oauth clients func NewREST(optsGetter restoptions.Getter) (*REST, error) { store := ®istry.Store{ NewFunc: func() runtime.Object { return &api.OAuthClient{} }, NewListFunc: func() runtime.Object { return &api.OAuthClientList{} }, KeyRootFunc: func(ctx kapi.Context) string { return EtcdPrefix }, KeyFunc: func(ctx kapi.Context, name string) (string, error) { return util.NoNamespaceKeyFunc(ctx, EtcdPrefix, name) }, ObjectNameFunc: func(obj runtime.Object) (string, error) { return obj.(*api.OAuthClient).Name, nil }, PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher { return oauthclient.Matcher(label, field) }, QualifiedResource: api.Resource("oauthclients"), CreateStrategy: oauthclient.Strategy, UpdateStrategy: oauthclient.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 routes. func NewREST(optsGetter restoptions.Getter, allocator route.RouteAllocator) (*REST, *StatusREST, error) { strategy := rest.NewStrategy(allocator) prefix := "/routes" store := ®istry.Store{ NewFunc: func() runtime.Object { return &api.Route{} }, NewListFunc: func() runtime.Object { return &api.RouteList{} }, 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.Route).Name, nil }, PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher { return rest.Matcher(label, field) }, QualifiedResource: api.Resource("routes"), CreateStrategy: strategy, UpdateStrategy: strategy, } if err := restoptions.ApplyOptions(optsGetter, store, prefix); err != nil { return nil, nil, err } statusStore := *store statusStore.UpdateStrategy = rest.StatusStrategy return &REST{store}, &StatusREST{&statusStore}, nil }
// NewREST returns a RESTStorage object that will work against routes. func NewREST(optsGetter restoptions.Getter, allocator route.RouteAllocator) (*REST, *StatusREST, error) { strategy := rest.NewStrategy(allocator) store := ®istry.Store{ NewFunc: func() runtime.Object { return &api.Route{} }, NewListFunc: func() runtime.Object { return &api.RouteList{} }, ObjectNameFunc: func(obj runtime.Object) (string, error) { return obj.(*api.Route).Name, nil }, PredicateFunc: func(label labels.Selector, field fields.Selector) storage.SelectionPredicate { return rest.Matcher(label, field) }, QualifiedResource: api.Resource("routes"), CreateStrategy: strategy, UpdateStrategy: strategy, } if err := restoptions.ApplyOptions(optsGetter, store, true, storage.NoTriggerPublisher); err != nil { return nil, nil, err } statusStore := *store statusStore.UpdateStrategy = rest.StatusStrategy return &REST{store}, &StatusREST{&statusStore}, nil }
// NewREST returns a RESTStorage object that will work against templates. func NewREST(optsGetter restoptions.Getter) (*REST, error) { prefix := "/templates" store := ®istry.Store{ NewFunc: func() runtime.Object { return &api.Template{} }, NewListFunc: func() runtime.Object { return &api.TemplateList{} }, KeyRootFunc: func(ctx kapi.Context) string { return registry.NamespaceKeyRootFunc(ctx, prefix) }, KeyFunc: func(ctx kapi.Context, name string) (string, error) { return registry.NamespaceKeyFunc(ctx, prefix, name) }, ObjectNameFunc: func(obj runtime.Object) (string, error) { return obj.(*api.Template).Name, nil }, PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher { return tregistry.Matcher(label, field) }, QualifiedResource: api.Resource("templates"), CreateStrategy: tregistry.Strategy, UpdateStrategy: tregistry.Strategy, ReturnDeletedObject: true, } if err := restoptions.ApplyOptions(optsGetter, store, prefix); err != nil { return nil, err } return &REST{store}, nil }
// 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 }
// NewREST returns a new REST. func NewREST(optsGetter restoptions.Getter) (*REST, error) { store := ®istry.Store{ NewFunc: func() runtime.Object { return &api.Image{} }, // NewListFunc returns an object capable of storing results of an etcd list. NewListFunc: func() runtime.Object { return &api.ImageList{} }, // Retrieve the name field of an image ObjectNameFunc: func(obj runtime.Object) (string, error) { return obj.(*api.Image).Name, nil }, // Used to match objects based on labels/fields for list and watch PredicateFunc: func(label labels.Selector, field fields.Selector) *generic.SelectionPredicate { return image.Matcher(label, field) }, QualifiedResource: api.Resource("images"), // Used to validate image creation CreateStrategy: image.Strategy, // Used to validate image updates UpdateStrategy: image.Strategy, ReturnDeletedObject: false, } if err := restoptions.ApplyOptions(optsGetter, store, false, storage.NoTriggerPublisher); err != nil { return nil, err } return &REST{store}, nil }
// NewREST returns a RESTStorage object that will work against authorize tokens func NewREST(optsGetter restoptions.Getter, clientGetter oauthclient.Getter) (*REST, error) { strategy := oauthauthorizetoken.NewStrategy(clientGetter) store := ®istry.Store{ NewFunc: func() runtime.Object { return &api.OAuthAuthorizeToken{} }, NewListFunc: func() runtime.Object { return &api.OAuthAuthorizeTokenList{} }, ObjectNameFunc: func(obj runtime.Object) (string, error) { return obj.(*api.OAuthAuthorizeToken).Name, nil }, PredicateFunc: func(label labels.Selector, field fields.Selector) *generic.SelectionPredicate { return oauthauthorizetoken.Matcher(label, field) }, TTLFunc: func(obj runtime.Object, existing uint64, update bool) (uint64, error) { token := obj.(*api.OAuthAuthorizeToken) expires := uint64(token.ExpiresIn) return expires, nil }, QualifiedResource: api.Resource("oauthauthorizetokens"), CreateStrategy: strategy, UpdateStrategy: strategy, } if err := restoptions.ApplyOptions(optsGetter, store, false, storage.NoTriggerPublisher); err != nil { return nil, err } return &REST{store}, nil }
// NewREST returns a new REST. func NewREST(optsGetter restoptions.Getter, defaultRegistry api.DefaultRegistry, subjectAccessReviewRegistry subjectaccessreview.Registry, limitVerifier imageadmission.LimitVerifier) (*REST, *StatusREST, *InternalREST, error) { prefix := "/imagestreams" store := registry.Store{ NewFunc: func() runtime.Object { return &api.ImageStream{} }, // NewListFunc returns an object capable of storing results of an etcd list. NewListFunc: func() runtime.Object { return &api.ImageStreamList{} }, // Produces a path that etcd understands, to the root of the resource // by combining the namespace in the context with the given prefix. KeyRootFunc: func(ctx kapi.Context) string { return registry.NamespaceKeyRootFunc(ctx, prefix) }, // Produces a path that etcd understands, to the resource by combining // the namespace in the context with the given prefix KeyFunc: func(ctx kapi.Context, name string) (string, error) { return registry.NamespaceKeyFunc(ctx, prefix, name) }, // Retrieve the name field of an image ObjectNameFunc: func(obj runtime.Object) (string, error) { return obj.(*api.ImageStream).Name, nil }, // Used to match objects based on labels/fields for list and watch PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher { return imagestream.MatchImageStream(label, field) }, QualifiedResource: api.Resource("imagestreams"), ReturnDeletedObject: false, } strategy := imagestream.NewStrategy(defaultRegistry, subjectAccessReviewRegistry, limitVerifier) rest := &REST{Store: &store, subjectAccessReviewRegistry: subjectAccessReviewRegistry} strategy.ImageStreamGetter = rest store.CreateStrategy = strategy store.UpdateStrategy = strategy store.Decorator = strategy.Decorate if err := restoptions.ApplyOptions(optsGetter, &store, prefix); err != nil { return nil, nil, nil, err } statusStore := store statusStore.Decorator = nil statusStore.CreateStrategy = nil statusStore.UpdateStrategy = imagestream.NewStatusStrategy(strategy) internalStore := store internalStrategy := imagestream.NewInternalStrategy(strategy) internalStore.Decorator = nil internalStore.CreateStrategy = internalStrategy internalStore.UpdateStrategy = internalStrategy return rest, &StatusREST{store: &statusStore}, &InternalREST{store: &internalStore}, nil }
// NewREST returns a RESTStorage object that will work against access tokens func NewREST(optsGetter restoptions.Getter, clientGetter oauthclient.Getter, backends ...storage.Interface) (*REST, error) { strategy := oauthaccesstoken.NewStrategy(clientGetter) store := ®istry.Store{ NewFunc: func() runtime.Object { return &api.OAuthAccessToken{} }, NewListFunc: func() runtime.Object { return &api.OAuthAccessTokenList{} }, KeyRootFunc: func(ctx kapi.Context) string { return EtcdPrefix }, KeyFunc: func(ctx kapi.Context, name string) (string, error) { return util.NoNamespaceKeyFunc(ctx, EtcdPrefix, name) }, ObjectNameFunc: func(obj runtime.Object) (string, error) { return obj.(*api.OAuthAccessToken).Name, nil }, PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher { return oauthaccesstoken.Matcher(label, field) }, TTLFunc: func(obj runtime.Object, existing uint64, update bool) (uint64, error) { token := obj.(*api.OAuthAccessToken) expires := uint64(token.ExpiresIn) return expires, nil }, QualifiedResource: api.Resource("oauthaccesstokens"), CreateStrategy: strategy, UpdateStrategy: strategy, } if err := restoptions.ApplyOptions(optsGetter, store, EtcdPrefix); err != nil { return nil, err } if len(backends) > 0 { // Build identical stores that talk to a single etcd, so we can verify the token is distributed after creation watchers := []rest.Watcher{} for i := range backends { watcher := *store watcher.Storage = backends[i] watchers = append(watchers, &watcher) } // Observe the cluster for the particular resource version, requiring at least one backend to succeed observer := observe.NewClusterObserver(store.Storage.Versioner(), watchers, 1) // After creation, wait for the new token to propagate store.AfterCreate = func(obj runtime.Object) error { return observer.ObserveResourceVersion(obj.(*api.OAuthAccessToken).ResourceVersion, 5*time.Second) } } return &REST{store}, nil }
// NewREST returns a new REST. func NewREST(optsGetter restoptions.Getter, defaultRegistry api.DefaultRegistry, subjectAccessReviewRegistry subjectaccessreview.Registry, limitVerifier imageadmission.LimitVerifier) (*REST, *StatusREST, *InternalREST, error) { store := registry.Store{ NewFunc: func() runtime.Object { return &api.ImageStream{} }, // NewListFunc returns an object capable of storing results of an etcd list. NewListFunc: func() runtime.Object { return &api.ImageStreamList{} }, // Retrieve the name field of an image ObjectNameFunc: func(obj runtime.Object) (string, error) { return obj.(*api.ImageStream).Name, nil }, // Used to match objects based on labels/fields for list and watch PredicateFunc: func(label labels.Selector, field fields.Selector) *generic.SelectionPredicate { return imagestream.Matcher(label, field) }, QualifiedResource: api.Resource("imagestreams"), ReturnDeletedObject: false, } rest := &REST{ Store: &store, subjectAccessReviewRegistry: subjectAccessReviewRegistry, } // strategy must be able to load image streams across namespaces during tag verification strategy := imagestream.NewStrategy(defaultRegistry, subjectAccessReviewRegistry, limitVerifier, rest) store.CreateStrategy = strategy store.UpdateStrategy = strategy store.Decorator = strategy.Decorate if err := restoptions.ApplyOptions(optsGetter, &store, true, storage.NoTriggerPublisher); err != nil { return nil, nil, nil, err } statusStrategy := imagestream.NewStatusStrategy(strategy) statusStore := store statusStore.Decorator = nil statusStore.CreateStrategy = nil statusStore.UpdateStrategy = statusStrategy statusREST := &StatusREST{store: &statusStore} internalStore := store internalStrategy := imagestream.NewInternalStrategy(strategy) internalStore.Decorator = nil internalStore.CreateStrategy = internalStrategy internalStore.UpdateStrategy = internalStrategy internalREST := &InternalREST{store: &internalStore} return rest, statusREST, internalREST, nil }
// NewREST returns a new REST. func NewREST(optsGetter restoptions.Getter) (*REST, error) { prefix := "/images" store := ®istry.Store{ NewFunc: func() runtime.Object { return &api.Image{} }, // NewListFunc returns an object capable of storing results of an etcd list. NewListFunc: func() runtime.Object { return &api.ImageList{} }, // Produces a path that etcd understands, to the root of the resource // by combining the namespace in the context with the given prefix. // Yet images are not namespace scoped, so we're returning just prefix here. KeyRootFunc: func(ctx kapi.Context) string { return prefix }, // Produces a path that etcd understands, to the resource by combining // the namespace in the context with the given prefix // Yet images are not namespace scoped, so we're returning just prefix here. KeyFunc: func(ctx kapi.Context, name string) (string, error) { return registry.NoNamespaceKeyFunc(ctx, prefix, name) }, // Retrieve the name field of an image ObjectNameFunc: func(obj runtime.Object) (string, error) { return obj.(*api.Image).Name, nil }, // Used to match objects based on labels/fields for list and watch PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher { return image.MatchImage(label, field) }, QualifiedResource: api.Resource("images"), // Used to validate image creation CreateStrategy: image.Strategy, // Used to validate image updates UpdateStrategy: image.Strategy, ReturnDeletedObject: false, } if err := restoptions.ApplyOptions(optsGetter, store, prefix); err != nil { return nil, err } return &REST{store}, nil }
// NewStorage returns a DeploymentConfigStorage containing the REST storage for // DeploymentConfig objects and their Scale subresources. func NewREST(optsGetter restoptions.Getter, rcNamespacer kclient.ReplicationControllersNamespacer) (*REST, *StatusREST, *ScaleREST, error) { prefix := "/deploymentconfigs" store := ®istry.Store{ NewFunc: func() runtime.Object { return &api.DeploymentConfig{} }, NewListFunc: func() runtime.Object { return &api.DeploymentConfigList{} }, QualifiedResource: api.Resource("deploymentconfigs"), 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.DeploymentConfig).Name, nil }, PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher { return deployconfig.Matcher(label, field) }, CreateStrategy: deployconfig.Strategy, UpdateStrategy: deployconfig.Strategy, DeleteStrategy: deployconfig.Strategy, ReturnDeletedObject: false, } if err := restoptions.ApplyOptions(optsGetter, store, prefix); err != nil { return nil, nil, nil, err } deploymentConfigREST := &REST{store} statusStore := *store statusStore.UpdateStrategy = deployconfig.StatusStrategy statusREST := &StatusREST{store: &statusStore} scaleREST := &ScaleREST{ registry: deployconfig.NewRegistry(deploymentConfigREST), rcNamespacer: rcNamespacer, } return deploymentConfigREST, statusREST, scaleREST, 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.HostSubnet{} }, NewListFunc: func() runtime.Object { return &api.HostSubnetList{} }, ObjectNameFunc: func(obj runtime.Object) (string, error) { return obj.(*api.HostSubnet).Host, nil }, PredicateFunc: func(label labels.Selector, field fields.Selector) storage.SelectionPredicate { return hostsubnet.Matcher(label, field) }, QualifiedResource: api.Resource("hostsubnets"), CreateStrategy: hostsubnet.Strategy, UpdateStrategy: hostsubnet.Strategy, } if err := restoptions.ApplyOptions(optsGetter, store, false, storage.NoTriggerPublisher); err != nil { return nil, err } return &REST{*store}, nil }
// NewREST returns a RESTStorage object that will work against egress network policy func NewREST(optsGetter restoptions.Getter) (*REST, error) { store := ®istry.Store{ NewFunc: func() runtime.Object { return &api.EgressNetworkPolicy{} }, NewListFunc: func() runtime.Object { return &api.EgressNetworkPolicyList{} }, ObjectNameFunc: func(obj runtime.Object) (string, error) { return obj.(*api.EgressNetworkPolicy).Name, nil }, PredicateFunc: func(label labels.Selector, field fields.Selector) *generic.SelectionPredicate { return egressnetworkpolicy.Matcher(label, field) }, QualifiedResource: api.Resource("egressnetworkpolicies"), CreateStrategy: egressnetworkpolicy.Strategy, UpdateStrategy: egressnetworkpolicy.Strategy, } if err := restoptions.ApplyOptions(optsGetter, store, true, storage.NoTriggerPublisher); err != nil { return nil, err } return &REST{*store}, nil }
// NewStorage returns a RESTStorage object that will work against PolicyBinding objects. func NewStorage(optsGetter restoptions.Getter) (*REST, error) { store := ®istry.Store{ NewFunc: func() runtime.Object { return &authorizationapi.PolicyBinding{} }, NewListFunc: func() runtime.Object { return &authorizationapi.PolicyBindingList{} }, QualifiedResource: authorizationapi.Resource("policybindings"), ObjectNameFunc: func(obj runtime.Object) (string, error) { return obj.(*authorizationapi.PolicyBinding).Name, nil }, PredicateFunc: func(label labels.Selector, field fields.Selector) *generic.SelectionPredicate { return policybinding.Matcher(label, field) }, CreateStrategy: policybinding.Strategy, UpdateStrategy: policybinding.Strategy, } if err := restoptions.ApplyOptions(optsGetter, store, true, storage.NoTriggerPublisher); err != nil { return nil, err } return &REST{store}, nil }
// NewREST returns a RESTStorage object that will work against oauth clients func NewREST(optsGetter restoptions.Getter, clientGetter oauthclient.Getter) (*REST, error) { store := ®istry.Store{ NewFunc: func() runtime.Object { return &api.OAuthClientAuthorization{} }, NewListFunc: func() runtime.Object { return &api.OAuthClientAuthorizationList{} }, ObjectNameFunc: func(obj runtime.Object) (string, error) { return obj.(*api.OAuthClientAuthorization).Name, nil }, PredicateFunc: func(label labels.Selector, field fields.Selector) *generic.SelectionPredicate { return oauthclientauthorization.Matcher(label, field) }, QualifiedResource: api.Resource("oauthclientauthorizations"), CreateStrategy: oauthclientauthorization.NewStrategy(clientGetter), UpdateStrategy: oauthclientauthorization.NewStrategy(clientGetter), } if err := restoptions.ApplyOptions(optsGetter, store, false, storage.NoTriggerPublisher); err != nil { return nil, err } return &REST{*store}, nil }
func makeStore(optsGetter restoptions.Getter) (*registry.Store, error) { store := ®istry.Store{ NewFunc: func() runtime.Object { return "aapi.ClusterResourceQuota{} }, NewListFunc: func() runtime.Object { return "aapi.ClusterResourceQuotaList{} }, QualifiedResource: quotaapi.Resource("clusterresourcequotas"), ObjectNameFunc: func(obj runtime.Object) (string, error) { return obj.(*quotaapi.ClusterResourceQuota).Name, nil }, PredicateFunc: func(label labels.Selector, field fields.Selector) *generic.SelectionPredicate { return Matcher(label, field) }, CreateStrategy: Strategy, UpdateStrategy: Strategy, DeleteStrategy: Strategy, ReturnDeletedObject: false, } if err := restoptions.ApplyOptions(optsGetter, store, false, storage.NoTriggerPublisher); err != nil { return nil, err } return store, nil }
// NewREST returns a RESTStorage object that will work against BuildConfig. func NewREST(optsGetter restoptions.Getter) (*REST, error) { store := ®istry.Store{ NewFunc: func() runtime.Object { return &api.BuildConfig{} }, NewListFunc: func() runtime.Object { return &api.BuildConfigList{} }, QualifiedResource: api.Resource("buildconfigs"), ObjectNameFunc: func(obj runtime.Object) (string, error) { return obj.(*api.BuildConfig).Name, nil }, PredicateFunc: func(label labels.Selector, field fields.Selector) storage.SelectionPredicate { return buildconfig.Matcher(label, field) }, CreateStrategy: buildconfig.Strategy, UpdateStrategy: buildconfig.Strategy, DeleteStrategy: buildconfig.Strategy, ReturnDeletedObject: false, } if err := restoptions.ApplyOptions(optsGetter, store, true, storage.NoTriggerPublisher); err != nil { return nil, err } return &REST{store}, nil }