Commit e2deec82 authored by ale's avatar ale
Browse files

Add 'archived' resource status

parent e2ae4a91
...@@ -437,12 +437,11 @@ const ( ...@@ -437,12 +437,11 @@ const (
ResourceStatusActive = "active" ResourceStatusActive = "active"
ResourceStatusInactive = "inactive" ResourceStatusInactive = "inactive"
ResourceStatusReadonly = "readonly" ResourceStatusReadonly = "readonly"
ResourceStatusArchived = "archived"
) )
// ResourceID is a a unique primary key in the resources space, with a // ResourceID is an opaque ID that uniquely identifies a resource in
// path-like representation. It must make sense to the database // the backend database. These should normally not be visible to users.
// backend and be reversible (i.e. there must be a bidirectional
// mapping between database objects and resource IDs).
type ResourceID string type ResourceID string
// Equal returns true if the two IDs are the same. // Equal returns true if the two IDs are the same.
......
...@@ -367,12 +367,10 @@ func allOf(funcs ...ValidatorFunc) ValidatorFunc { ...@@ -367,12 +367,10 @@ func allOf(funcs ...ValidatorFunc) ValidatorFunc {
// various fields in a Resource, depending on its type. // various fields in a Resource, depending on its type.
type ResourceValidatorFunc func(context.Context, *Resource, *User) error type ResourceValidatorFunc func(context.Context, *Resource, *User) error
// The linter thinks this function is too complex.
// nolint: gocyclo
func (v *validationContext) validateResource(_ context.Context, r *Resource, user *User) error { func (v *validationContext) validateResource(_ context.Context, r *Resource, user *User) error {
// Validate the status enum. // Validate the status enum.
switch r.Status { switch r.Status {
case ResourceStatusActive, ResourceStatusInactive, ResourceStatusReadonly: case ResourceStatusActive, ResourceStatusInactive, ResourceStatusReadonly, ResourceStatusArchived:
default: default:
return errors.New("unknown resource status") return errors.New("unknown resource status")
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment