AEP-0164 Linter Rules
Undelete methods- HTTP body
Undelete methods: HTTP body
This rule enforces that all Undelete
RPCs use *
as the HTTP body
, as mandated in
AEP-164.
Details
This rule looks at any message beginning with Undelete
, and complains
if the HTTP body
field is anything other than *
.
Examples
Incorrect code for this rule:
Correct code for this rule:
Disabling
If you need to violate this rule, use a leading comment above the method. Remember to also include an aep.dev/not-precedent comment explaining why.
If you need to violate this rule for an entire file, place the comment at the top of the file.
Undelete methods- POST HTTP verb
Undelete methods: POST HTTP verb
This rule enforces that all Undelete
RPCs use the POST
HTTP verb, as
mandated in AEP-164.
Details
This rule looks at any message beginning with Undelete
, and complains
if the HTTP verb is anything other than POST
. It does check additional
bindings if they are present.
Examples
Incorrect code for this rule:
Correct code for this rule:
Disabling
If you need to violate this rule, use a leading comment above the method. Remember to also include an aep.dev/not-precedent comment explaining why.
If you need to violate this rule for an entire file, place the comment at the top of the file.
Undelete methods- URI suffix
Undelete methods: URI suffix
This rule enforces that Undelete
methods include the :undelete
suffix
in the REST URI, as mandated in AEP-164.
Details
This rule looks at any method whose name starts with Undelete
, and
complains if the HTTP URI does not end with :undelete
.
Examples
Incorrect code for this rule:
Correct code for this rule:
Disabling
If you need to violate this rule, use a leading comment above the method. Remember to also include an aep.dev/not-precedent comment explaining why.
If you need to violate this rule for an entire file, place the comment at the top of the file.
Undelete methods- Request message
Undelete methods: Request message
This rule enforces that all Undelete
RPCs have a request message name of
Undelete*Request
, as mandated in AEP-164.
Details
This rule looks at any message beginning with Undelete
, and complains
if the name of the corresponding input message does not match the name of the
RPC with the suffix Request
appended.
Examples
Incorrect code for this rule:
Correct code for this rule:
Disabling
If you need to violate this rule, use a leading comment above the method. Remember to also include an aep.dev/not-precedent comment explaining why.
If you need to violate this rule for an entire file, place the comment at the top of the file.
Undelete methods- Field behavior
Undelete methods: Field behavior
This rule enforces that all Undelete
methods have
google.api.field_behavior
set to REQUIRED
on their string name
field, as
mandated in AEP-164.
Details
This rule looks at any message matching Undelete*Request
and complains if the
name
field does not have a google.api.field_behavior
annotation with a
value of REQUIRED
.
Examples
Incorrect code for this rule:
Correct code for this rule:
Disabling
If you need to violate this rule, use a leading comment above the field. Remember to also include an aep.dev/not-precedent comment explaining why.
If you need to violate this rule for an entire file, place the comment at the top of the file.
Undelete methods- Name field
Undelete methods: Name field
This rule enforces that all Undelete
methods have a string name
field in the request message, as mandated in AEP-164.
Details
This rule looks at any message matching Undelete*Request
and complains if
either the name
field is missing, or if it has any type other than string
.
Examples
Incorrect code for this rule:
Correct code for this rule:
Disabling
If you need to violate this rule, use a leading comment above the message (if
the name
field is missing) or above the field (if it is the wrong type).
Remember to also include an aep.dev/not-precedent comment explaining why.
If you need to violate this rule for an entire file, place the comment at the top of the file.
Undelete methods- Resource reference
Undelete methods: Resource reference
This rule enforces that all Undelete
methods have
google.api.resource_reference
on their string name
field, as mandated in
AEP-164.
Details
This rule looks at the name
field of any message matching Undelete*Request
and complains if it does not have a google.api.resource_reference
annotation.
Examples
Incorrect code for this rule:
Correct code for this rule:
Disabling
If you need to violate this rule, use a leading comment above the field. Remember to also include an aep.dev/not-precedent comment explaining why.
If you need to violate this rule for an entire file, place the comment at the top of the file.
Undelete methods- Unknown fields
Undelete methods: Unknown fields
This rule enforces that all Undelete
requests do not have unexpected
fields, as mandated in AEP-164.
Details
This rule looks at any message matching Undelete*Request
and complains if it
comes across any fields other than:
string name
(AEP-164)string etag
(AEP-154)string request_id
(AEP-155)bool validate_only
(AEP-163)
Examples
Incorrect code for this rule:
Correct code for this rule:
Disabling
If you need to violate this rule, use a leading comment above the field. Remember to also include an aep.dev/not-precedent comment explaining why.
If you need to violate this rule for an entire file, place the comment at the top of the file.
Resources supporting soft delete- expire_time field required
Resources supporting soft delete: expire_time
field required
This rule enforces that all resources supporting soft delete have an
google.protobuf.Timestamp expire_time
field, as mandated in AEP-164.
Details
This rule looks at any resource with a corresponding Undelete*
method, and
complains if it does not have a google.protobuf.Timestamp expire_time
field.
Examples
Incorrect code for this rule:
Correct code for this rule:
Disabling
If you need to violate this rule, use a leading comment above the resource. Remember to also include an aep.dev/not-precedent comment explaining why.
If you need to violate this rule for an entire file, place the comment at the top of the file.
Long-running Undelete
Long-running Undelete
This rule enforces that declarative-friendly undelete methods use long-running operations, as mandated in AEP-164.
Details
This rule looks at any Undelete
method connected to a resource with a
google.api.resource
annotation that includes style: DECLARATIVE_FRIENDLY
,
and complains if it does not use long-running operations.
Examples
Incorrect code for this rule:
Correct code for this rule:
Disabling
If you need to violate this rule, use a leading comment above the message. Remember to also include an aep.dev/not-precedent comment explaining why.
Note: Violations of declarative-friendly rules should be rare, as tools are likely to expect strong consistency.
If you need to violate this rule for an entire file, place the comment at the top of the file.
Undelete methods- Response message
Undelete methods: Response message
This rule enforces that all Undelete
RPCs have a response message of
the resource, as mandated in AEP-164.
Details
This rule looks at any message beginning with Undelete
, and complains
if the name of the corresponding output message does not match the name of the
RPC with the prefix Undelete
removed.
It also permits a response of google.longrunning.Operation
; in this case, it
checks the response_type
in the google.longrunning.operation_info
annotation and ensures that it corresponds to the name of the RPC with the
prefix Undelete
removed.
Examples
Standard
Incorrect code for this rule:
Correct code for this rule:
Long-running operation
Incorrect code for this rule:
Correct code for this rule:
Disabling
If you need to violate this rule, use a leading comment above the method. Remember to also include an aep.dev/not-precedent comment explaining why.
If you need to violate this rule for an entire file, place the comment at the top of the file.