github.com/googleapis/api-linter@v1.65.2/docs/rules/0135/response-lro.md (about) 1 --- 2 rule: 3 aip: 135 4 name: [core, '0135', response-lro] 5 summary: | 6 Declarative-friendly delete methods should use long-running operations. 7 permalink: /135/response-lro 8 redirect_from: 9 - /0135/response-lro 10 --- 11 12 # Long-running Delete 13 14 This rule enforces that declarative-friendly delete methods use long-running 15 operations, as mandated in [AIP-135][]. 16 17 ## Details 18 19 This rule looks at any `Delete` method connected to a resource with a 20 `google.api.resource` annotation that includes `style: DECLARATIVE_FRIENDLY`, 21 and complains if it does not use long-running operations. 22 23 ## Examples 24 25 **Incorrect** code for this rule: 26 27 ```proto 28 // Incorrect. 29 // Assuming that Book is styled declarative-friendly, DeleteBook should 30 // return a long-running operation. 31 rpc DeleteBook(DeleteBookRequest) returns (Book) { 32 option (google.api.http) = { 33 delete: "/v1/{name=publishers/*/books/*}" 34 }; 35 } 36 ``` 37 38 **Correct** code for this rule: 39 40 ```proto 41 // Correct. 42 // Assuming that Book is styled declarative-friendly... 43 rpc DeleteBook(DeleteBookRequest) returns (google.longrunning.Operation) { 44 option (google.api.http) = { 45 delete: "/v1/{name=publishers/*/books/*}" 46 }; 47 option (google.longrunning.operation_info) = { 48 response_type: "Book" 49 metadata_type: "OperationMetadata" 50 }; 51 } 52 ``` 53 54 ## Disabling 55 56 If you need to violate this rule, use a leading comment above the message. 57 Remember to also include an [aip.dev/not-precedent][] comment explaining why. 58 59 ```proto 60 // (-- api-linter: core::0135::response-lro=disabled 61 // aip.dev/not-precedent: We need to do this because reasons. --) 62 rpc DeleteBook(DeleteBookRequest) returns (Book) { 63 option (google.api.http) = { 64 delete: "/v1/{name=publishers/*/books/*}" 65 }; 66 } 67 ``` 68 69 **Note:** Violations of declarative-friendly rules should be rare, as tools are 70 likely to expect strong consistency. 71 72 If you need to violate this rule for an entire file, place the comment at the 73 top of the file. 74 75 [aip-135]: https://aip.dev/135 76 [aip.dev/not-precedent]: https://aip.dev/not-precedent