2
0

code.proto 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. // Copyright (c) 2015, Google Inc.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.rpc;
  16. option java_multiple_files = true;
  17. option java_outer_classname = "CodeProto";
  18. option java_package = "com.google.rpc";
  19. // The canonical error codes for Google APIs.
  20. // Warnings:
  21. //
  22. // - Do not change any numeric assignments.
  23. // - Changes to this list should be made only if there is a compelling
  24. // need that can't be satisfied in another way.
  25. //
  26. // Sometimes multiple error codes may apply. Services should return
  27. // the most specific error code that applies. For example, prefer
  28. // `OUT_OF_RANGE` over `FAILED_PRECONDITION` if both codes apply.
  29. // Similarly prefer `NOT_FOUND` or `ALREADY_EXISTS` over `FAILED_PRECONDITION`.
  30. enum Code {
  31. // Not an error; returned on success
  32. //
  33. // HTTP Mapping: 200 OK
  34. OK = 0;
  35. // The operation was cancelled, typically by the caller.
  36. //
  37. // HTTP Mapping: 499 Client Closed Request
  38. CANCELLED = 1;
  39. // Unknown error. For example, this error may be returned when
  40. // a `Status` value received from another address space belongs to
  41. // an error space that is not known in this address space. Also
  42. // errors raised by APIs that do not return enough error information
  43. // may be converted to this error.
  44. //
  45. // HTTP Mapping: 500 Internal Server Error
  46. UNKNOWN = 2;
  47. // The client specified an invalid argument. Note that this differs
  48. // from `FAILED_PRECONDITION`. `INVALID_ARGUMENT` indicates arguments
  49. // that are problematic regardless of the state of the system
  50. // (e.g., a malformed file name).
  51. //
  52. // HTTP Mapping: 400 Bad Request
  53. INVALID_ARGUMENT = 3;
  54. // The deadline expired before the operation could complete. For operations
  55. // that change the state of the system, this error may be returned
  56. // even if the operation has completed successfully. For example, a
  57. // successful response from a server could have been delayed long
  58. // enough for the deadline to expire.
  59. //
  60. // HTTP Mapping: 504 Gateway Timeout
  61. DEADLINE_EXCEEDED = 4;
  62. // Some requested entity (e.g., file or directory) was not found.
  63. // For privacy reasons, this code *might* be returned when the client
  64. // does not have the access rights to the entity.
  65. //
  66. // HTTP Mapping: 404 Not Found
  67. NOT_FOUND = 5;
  68. // The entity that a client attempted to create (e.g., file or directory)
  69. // already exists.
  70. //
  71. // HTTP Mapping: 409 Conflict
  72. ALREADY_EXISTS = 6;
  73. // The caller does not have permission to execute the specified
  74. // operation. `PERMISSION_DENIED` must not be used for rejections
  75. // caused by exhausting some resource (use `RESOURCE_EXHAUSTED`
  76. // instead for those errors). `PERMISSION_DENIED` must not be
  77. // used if the caller can not be identified (use `UNAUTHENTICATED`
  78. // instead for those errors).
  79. //
  80. // HTTP Mapping: 403 Forbidden
  81. PERMISSION_DENIED = 7;
  82. // The request does not have valid authentication credentials for the
  83. // operation.
  84. //
  85. // HTTP Mapping: 401 Unauthorized
  86. UNAUTHENTICATED = 16;
  87. // Some resource has been exhausted, perhaps a per-user quota, or
  88. // perhaps the entire file system is out of space.
  89. //
  90. // HTTP Mapping: 429 Too Many Requests
  91. RESOURCE_EXHAUSTED = 8;
  92. // The operation was rejected because the system is not in a state
  93. // required for the operation's execution. For example, the directory
  94. // to be deleted is non-empty, an rmdir operation is applied to
  95. // a non-directory, etc.
  96. //
  97. // Service implementors can use the following guidelines to decide
  98. // between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`:
  99. // (a) Use `UNAVAILABLE` if the client can retry just the failing call.
  100. // (b) Use `ABORTED` if the client should retry at a higher level
  101. // (e.g., restarting a read-modify-write sequence).
  102. // (c) Use `FAILED_PRECONDITION` if the client should not retry until
  103. // the system state has been explicitly fixed. E.g., if an "rmdir"
  104. // fails because the directory is non-empty, `FAILED_PRECONDITION`
  105. // should be returned since the client should not retry unless
  106. // the files are deleted from the directory.
  107. // (d) Use `FAILED_PRECONDITION` if the client performs conditional
  108. // REST Get/Update/Delete on a resource and the resource on the
  109. // server does not match the condition. E.g., conflicting
  110. // read-modify-write on the same resource.
  111. //
  112. // HTTP Mapping: 400 Bad Request
  113. //
  114. // NOTE: HTTP spec says `412 Precondition Failed` should be used only if
  115. // the request contains Etag-related headers. So if the server does see
  116. // Etag-related headers in the request, it may choose to return 412
  117. // instead of 400 for this error code.
  118. FAILED_PRECONDITION = 9;
  119. // The operation was aborted, typically due to a concurrency issue such as
  120. // a sequencer check failure or transaction abort.
  121. //
  122. // See the guidelines above for deciding between `FAILED_PRECONDITION`,
  123. // `ABORTED`, and `UNAVAILABLE`.
  124. //
  125. // HTTP Mapping: 409 Conflict
  126. ABORTED = 10;
  127. // The operation was attempted past the valid range. E.g., seeking or
  128. // reading past end-of-file.
  129. //
  130. // Unlike `INVALID_ARGUMENT`, this error indicates a problem that may
  131. // be fixed if the system state changes. For example, a 32-bit file
  132. // system will generate `INVALID_ARGUMENT` if asked to read at an
  133. // offset that is not in the range [0,2^32-1], but it will generate
  134. // `OUT_OF_RANGE` if asked to read from an offset past the current
  135. // file size.
  136. //
  137. // There is a fair bit of overlap between `FAILED_PRECONDITION` and
  138. // `OUT_OF_RANGE`. We recommend using `OUT_OF_RANGE` (the more specific
  139. // error) when it applies so that callers who are iterating through
  140. // a space can easily look for an `OUT_OF_RANGE` error to detect when
  141. // they are done.
  142. //
  143. // HTTP Mapping: 400 Bad Request
  144. OUT_OF_RANGE = 11;
  145. // The operation is not implemented or is not supported/enabled in this
  146. // service.
  147. //
  148. // HTTP Mapping: 501 Not Implemented
  149. UNIMPLEMENTED = 12;
  150. // Internal errors. This means that some invariants expected by the
  151. // underlying system have been broken. This error code is reserved
  152. // for serious errors.
  153. //
  154. // HTTP Mapping: 500 Internal Server Error
  155. INTERNAL = 13;
  156. // The service is currently unavailable. This is most likely a
  157. // transient condition, which can be corrected by retrying with
  158. // a backoff.
  159. //
  160. // See the guidelines above for deciding between `FAILED_PRECONDITION`,
  161. // `ABORTED`, and `UNAVAILABLE`.
  162. //
  163. // HTTP Mapping: 503 Service Unavailable
  164. UNAVAILABLE = 14;
  165. // Unrecoverable data loss or corruption.
  166. //
  167. // HTTP Mapping: 500 Internal Server Error
  168. DATA_LOSS = 15;
  169. }