// 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 DeploymentConfig objects. func newREST(s storage.Interface) *REST { store := &etcdgeneric.Etcd{ NewFunc: func() runtime.Object { return &api.DeploymentConfig{} }, NewListFunc: func() runtime.Object { return &api.DeploymentConfigList{} }, EndpointName: "deploymentConfig", KeyRootFunc: func(ctx kapi.Context) string { return etcdgeneric.NamespaceKeyRootFunc(ctx, DeploymentConfigPath) }, KeyFunc: func(ctx kapi.Context, id string) (string, error) { return etcdgeneric.NamespaceKeyFunc(ctx, DeploymentConfigPath, 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, Storage: s, } return &REST{store} }
// NewStorage returns a DeploymentConfigStorage containing the REST storage for // DeploymentConfig objects and their Scale subresources. func NewREST(s storage.Interface, rcNamespacer kclient.ReplicationControllersNamespacer) (*REST, *ScaleREST) { prefix := "/deploymentconfigs" store := &etcdgeneric.Etcd{ NewFunc: func() runtime.Object { return &api.DeploymentConfig{} }, NewListFunc: func() runtime.Object { return &api.DeploymentConfigList{} }, EndpointName: "deploymentconfigs", 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.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, Storage: s, } deploymentConfigREST := &REST{store} scaleREST := &ScaleREST{ registry: deployconfig.NewRegistry(deploymentConfigREST), rcNamespacer: rcNamespacer, } return deploymentConfigREST, scaleREST }
// 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 }