Require DeleteStrategy for all registry.Store

All registry.Store objects already set a non-nil DeleteStrategy.
This change ensures that all future objects do so as well.

Signed-off-by: Monis Khan <mkhan@redhat.com>
This commit is contained in:
Monis Khan 2017-05-24 18:56:51 -04:00
parent 89a76b8c8b
commit 08fcd79e1f
No known key found for this signature in database
GPG Key ID: 52C90ADA01B269B8

View File

@ -143,8 +143,7 @@ type Store struct {
// AfterUpdate implements a further operation to run after a resource is
// updated and before it is decorated, optional.
AfterUpdate ObjectFunc
// DeleteStrategy implements resource-specific behavior during deletion,
// optional.
// DeleteStrategy implements resource-specific behavior during deletion.
DeleteStrategy rest.RESTDeleteStrategy
// AfterDelete implements a further operation to run after a resource is
// deleted and before it is decorated, optional.
@ -1138,6 +1137,10 @@ func (e *Store) CompleteWithOptions(options *generic.StoreOptions) error {
return fmt.Errorf("store for %s must have CreateStrategy or UpdateStrategy set", e.QualifiedResource.String())
}
if e.DeleteStrategy == nil {
return fmt.Errorf("store for %s must have DeleteStrategy set", e.QualifiedResource.String())
}
if options.RESTOptions == nil {
return fmt.Errorf("options for %s must have RESTOptions set", e.QualifiedResource.String())
}