code.proto 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. // Copyright 2017 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 go_package = "google.golang.org/genproto/googleapis/rpc/code;code";
  17. option java_multiple_files = true;
  18. option java_outer_classname = "CodeProto";
  19. option java_package = "com.google.rpc";
  20. option objc_class_prefix = "RPC";
  21. // The canonical error codes for Google APIs.
  22. //
  23. //
  24. // Sometimes multiple error codes may apply. Services should return
  25. // the most specific error code that applies. For example, prefer
  26. // `OUT_OF_RANGE` over `FAILED_PRECONDITION` if both codes apply.
  27. // Similarly prefer `NOT_FOUND` or `ALREADY_EXISTS` over `FAILED_PRECONDITION`.
  28. enum Code {
  29. // Not an error; returned on success
  30. //
  31. // HTTP Mapping: 200 OK
  32. OK = 0;
  33. // The operation was cancelled, typically by the caller.
  34. //
  35. // HTTP Mapping: 499 Client Closed Request
  36. CANCELLED = 1;
  37. // Unknown error. For example, this error may be returned when
  38. // a `Status` value received from another address space belongs to
  39. // an error space that is not known in this address space. Also
  40. // errors raised by APIs that do not return enough error information
  41. // may be converted to this error.
  42. //
  43. // HTTP Mapping: 500 Internal Server Error
  44. UNKNOWN = 2;
  45. // The client specified an invalid argument. Note that this differs
  46. // from `FAILED_PRECONDITION`. `INVALID_ARGUMENT` indicates arguments
  47. // that are problematic regardless of the state of the system
  48. // (e.g., a malformed file name).
  49. //
  50. // HTTP Mapping: 400 Bad Request
  51. INVALID_ARGUMENT = 3;
  52. // The deadline expired before the operation could complete. For operations
  53. // that change the state of the system, this error may be returned
  54. // even if the operation has completed successfully. For example, a
  55. // successful response from a server could have been delayed long
  56. // enough for the deadline to expire.
  57. //
  58. // HTTP Mapping: 504 Gateway Timeout
  59. DEADLINE_EXCEEDED = 4;
  60. // Some requested entity (e.g., file or directory) was not found.
  61. //
  62. // Note to server developers: if a request is denied for an entire class
  63. // of users, such as gradual feature rollout or undocumented whitelist,
  64. // `NOT_FOUND` may be used. If a request is denied for some users within
  65. // a class of users, such as user-based access control, `PERMISSION_DENIED`
  66. // must be used.
  67. //
  68. // HTTP Mapping: 404 Not Found
  69. NOT_FOUND = 5;
  70. // The entity that a client attempted to create (e.g., file or directory)
  71. // already exists.
  72. //
  73. // HTTP Mapping: 409 Conflict
  74. ALREADY_EXISTS = 6;
  75. // The caller does not have permission to execute the specified
  76. // operation. `PERMISSION_DENIED` must not be used for rejections
  77. // caused by exhausting some resource (use `RESOURCE_EXHAUSTED`
  78. // instead for those errors). `PERMISSION_DENIED` must not be
  79. // used if the caller can not be identified (use `UNAUTHENTICATED`
  80. // instead for those errors). This error code does not imply the
  81. // request is valid or the requested entity exists or satisfies
  82. // other pre-conditions.
  83. //
  84. // HTTP Mapping: 403 Forbidden
  85. PERMISSION_DENIED = 7;
  86. // The request does not have valid authentication credentials for the
  87. // operation.
  88. //
  89. // HTTP Mapping: 401 Unauthorized
  90. UNAUTHENTICATED = 16;
  91. // Some resource has been exhausted, perhaps a per-user quota, or
  92. // perhaps the entire file system is out of space.
  93. //
  94. // HTTP Mapping: 429 Too Many Requests
  95. RESOURCE_EXHAUSTED = 8;
  96. // The operation was rejected because the system is not in a state
  97. // required for the operation's execution. For example, the directory
  98. // to be deleted is non-empty, an rmdir operation is applied to
  99. // a non-directory, etc.
  100. //
  101. // Service implementors can use the following guidelines to decide
  102. // between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`:
  103. // (a) Use `UNAVAILABLE` if the client can retry just the failing call.
  104. // (b) Use `ABORTED` if the client should retry at a higher level
  105. // (e.g., when a client-specified test-and-set fails, indicating the
  106. // client should restart a read-modify-write sequence).
  107. // (c) Use `FAILED_PRECONDITION` if the client should not retry until
  108. // the system state has been explicitly fixed. E.g., if an "rmdir"
  109. // fails because the directory is non-empty, `FAILED_PRECONDITION`
  110. // should be returned since the client should not retry unless
  111. // the files are deleted from the directory.
  112. //
  113. // HTTP Mapping: 400 Bad Request
  114. FAILED_PRECONDITION = 9;
  115. // The operation was aborted, typically due to a concurrency issue such as
  116. // a sequencer check failure or transaction abort.
  117. //
  118. // See the guidelines above for deciding between `FAILED_PRECONDITION`,
  119. // `ABORTED`, and `UNAVAILABLE`.
  120. //
  121. // HTTP Mapping: 409 Conflict
  122. ABORTED = 10;
  123. // The operation was attempted past the valid range. E.g., seeking or
  124. // reading past end-of-file.
  125. //
  126. // Unlike `INVALID_ARGUMENT`, this error indicates a problem that may
  127. // be fixed if the system state changes. For example, a 32-bit file
  128. // system will generate `INVALID_ARGUMENT` if asked to read at an
  129. // offset that is not in the range [0,2^32-1], but it will generate
  130. // `OUT_OF_RANGE` if asked to read from an offset past the current
  131. // file size.
  132. //
  133. // There is a fair bit of overlap between `FAILED_PRECONDITION` and
  134. // `OUT_OF_RANGE`. We recommend using `OUT_OF_RANGE` (the more specific
  135. // error) when it applies so that callers who are iterating through
  136. // a space can easily look for an `OUT_OF_RANGE` error to detect when
  137. // they are done.
  138. //
  139. // HTTP Mapping: 400 Bad Request
  140. OUT_OF_RANGE = 11;
  141. // The operation is not implemented or is not supported/enabled in this
  142. // service.
  143. //
  144. // HTTP Mapping: 501 Not Implemented
  145. UNIMPLEMENTED = 12;
  146. // Internal errors. This means that some invariants expected by the
  147. // underlying system have been broken. This error code is reserved
  148. // for serious errors.
  149. //
  150. // HTTP Mapping: 500 Internal Server Error
  151. INTERNAL = 13;
  152. // The service is currently unavailable. This is most likely a
  153. // transient condition, which can be corrected by retrying with
  154. // a backoff.
  155. //
  156. // See the guidelines above for deciding between `FAILED_PRECONDITION`,
  157. // `ABORTED`, and `UNAVAILABLE`.
  158. //
  159. // HTTP Mapping: 503 Service Unavailable
  160. UNAVAILABLE = 14;
  161. // Unrecoverable data loss or corruption.
  162. //
  163. // HTTP Mapping: 500 Internal Server Error
  164. DATA_LOSS = 15;
  165. }