Commit e2deec82 authored by ale's avatar ale
Browse files

Add 'archived' resource status

parent e2ae4a91
......@@ -437,12 +437,11 @@ const (
ResourceStatusActive = "active"
ResourceStatusInactive = "inactive"
ResourceStatusReadonly = "readonly"
ResourceStatusArchived = "archived"
// ResourceID is a a unique primary key in the resources space, with a
// path-like representation. It must make sense to the database
// backend and be reversible (i.e. there must be a bidirectional
// mapping between database objects and resource IDs).
// ResourceID is an opaque ID that uniquely identifies a resource in
// the backend database. These should normally not be visible to users.
type ResourceID string
// Equal returns true if the two IDs are the same.
......@@ -367,12 +367,10 @@ func allOf(funcs ...ValidatorFunc) ValidatorFunc {
// various fields in a Resource, depending on its type.
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 {
// Validate the status enum.
switch r.Status {
case ResourceStatusActive, ResourceStatusInactive, ResourceStatusReadonly:
case ResourceStatusActive, ResourceStatusInactive, ResourceStatusReadonly, ResourceStatusArchived:
return errors.New("unknown resource status")
Supports Markdown
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