Skip to content

Commit 9e8d12f

Browse files
committed
feat(164): specify create overwrites soft deleted
To help ensure that declarative clients do not have a degraded user experience with resources that implement soft-delete, specify that create overwrites an existing soft-deleted resource. This ensures that a declarative tool can still properly apply a resource, overwriting it instead of requiring an out of band force delete or having the user modify the ID of the resource. fixes #111 (which includes some significant debate and context on why this approach was chosen).
1 parent c735344 commit 9e8d12f

2 files changed

Lines changed: 11 additions & 26 deletions

File tree

aep/general/0121/aep.md.j2

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ Examples of strong consistency include:
106106
get request for a resource **must** return the final values from the update
107107
request.
108108
- Following a successful delete that is the latest mutation on a resource, a
109-
get request for a resource **must** return `NOT_FOUND` (or the resource with
110-
the `DELETED` state value in the case of [soft delete][])
109+
get request for a resource **must** return `NOT_FOUND`.
111110

112111
Clients of resource-oriented APIs often need to orchestrate multiple operations
113112
in sequence (e.g., create resource A, create resource B which depends on A),

aep/general/0164/aep.md.j2

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,19 @@ A resource that supports soft delete **should** provide an `Undelete` method:
6060

6161
{% endtabs %}
6262

63-
### Long-running undelete
63+
### Create
6464

65-
Some resources take longer to undelete a resource than is reasonable for a
66-
regular API request. In this situation, the API **should** follow the
67-
long-running request pattern AEP-151.
65+
If a user attempts a create on a soft-deleted resource, the request **must**
66+
succeed, acting as if the resource did not exist previously.
6867

6968
### List and Get
7069

71-
Soft-deleted resources **should not** be returned in `List` AEP-132 responses
72-
by default (unless `bool show_deleted` is true).
70+
Soft-deleted resources **must not** be returned in `List` AEP-132 responses by
71+
default (unless `bool show_deleted` is true).
7372

74-
A `Get` AEP-131 request for a soft deleted resource **should** error with
75-
`410 Gone` unless `bool show_deleted` is true, in which case soft-deleted
76-
resources **must** return the resource.
73+
A `Get` AEP-131 request for a soft deleted resource **must** return with a
74+
`410 Gone` response unless `bool show_deleted` is true, in which case
75+
soft-deleted resources **must** return the resource.
7776

7877
Services that soft delete resources **may** choose a reasonable strategy for
7978
purging those resources, including automatic purging after a reasonable time
@@ -84,9 +83,6 @@ removed.
8483

8584
### Declarative-friendly resources
8685

87-
A resource that is declarative-friendly AEP-128 **should** support soft delete
88-
and undelete.
89-
9086
**Important:** There is an ambiguity in declarative tooling between "create"
9187
and "undelete". When given an alias which was previously deleted and a
9288
directive to make it exist, tooling usually does not know if the intent is to
@@ -96,27 +92,17 @@ a new resource: the only way to undelete is to explicitly use the undelete RPC
9692
(an imperative operation), and declarative tools **may** elect not to map
9793
anything to undelete at all.
9894

99-
Declarative-friendly resources **must** use long-running operations for both
100-
soft delete and undelete. The service **may** return an LRO that is already set
101-
to done if the request is effectively immediate.
102-
103-
Declarative-friendly resources **must** include `validate_only` AEP-163 and
104-
`etag` AEP-154 in their `Undelete` methods.
105-
10695
### Errors
10796

108-
If the user does not have permission to access the resource, regardless of
109-
whether or not it exists, the service **must** error with `403 Forbidden`.
110-
Permission **must** be checked prior to checking if the resource exists.
97+
Also see [errors](/errors) for additional guidance.
11198

11299
If the user does have proper permission, but the requested resource does not
113100
exist (either it was never created or already expunged), the service **must**
114101
error with `404 Not Found`.
115102

116103
If the user calling a soft `Delete` has proper permission, but the requested
117104
resource is already deleted, the service **must** succeed if `allow_missing` is
118-
`true`, and **should** error with `404 Not Found` if `allow_missing` is
119-
`false`.
105+
`true`, and **must** error with `404 Not Found` if `allow_missing` is `false`.
120106

121107
If the user calling `Undelete` has proper permission, but the requested
122108
resource is not deleted, the service **must** error with `409 Conflict`.

0 commit comments

Comments
 (0)