error_details.proto 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. // Copyright 2024 Google LLC
  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. import "google/protobuf/duration.proto";
  17. option go_package = "google.golang.org/genproto/googleapis/rpc/errdetails;errdetails";
  18. option java_multiple_files = true;
  19. option java_outer_classname = "ErrorDetailsProto";
  20. option java_package = "com.google.rpc";
  21. option objc_class_prefix = "RPC";
  22. // Describes the cause of the error with structured details.
  23. //
  24. // Example of an error when contacting the "pubsub.googleapis.com" API when it
  25. // is not enabled:
  26. //
  27. // { "reason": "API_DISABLED"
  28. // "domain": "googleapis.com"
  29. // "metadata": {
  30. // "resource": "projects/123",
  31. // "service": "pubsub.googleapis.com"
  32. // }
  33. // }
  34. //
  35. // This response indicates that the pubsub.googleapis.com API is not enabled.
  36. //
  37. // Example of an error that is returned when attempting to create a Spanner
  38. // instance in a region that is out of stock:
  39. //
  40. // { "reason": "STOCKOUT"
  41. // "domain": "spanner.googleapis.com",
  42. // "metadata": {
  43. // "availableRegions": "us-central1,us-east2"
  44. // }
  45. // }
  46. message ErrorInfo {
  47. // The reason of the error. This is a constant value that identifies the
  48. // proximate cause of the error. Error reasons are unique within a particular
  49. // domain of errors. This should be at most 63 characters and match a
  50. // regular expression of `[A-Z][A-Z0-9_]+[A-Z0-9]`, which represents
  51. // UPPER_SNAKE_CASE.
  52. string reason = 1;
  53. // The logical grouping to which the "reason" belongs. The error domain
  54. // is typically the registered service name of the tool or product that
  55. // generates the error. Example: "pubsub.googleapis.com". If the error is
  56. // generated by some common infrastructure, the error domain must be a
  57. // globally unique value that identifies the infrastructure. For Google API
  58. // infrastructure, the error domain is "googleapis.com".
  59. string domain = 2;
  60. // Additional structured details about this error.
  61. //
  62. // Keys should match /[a-zA-Z0-9-_]/ and be limited to 64 characters in
  63. // length. When identifying the current value of an exceeded limit, the units
  64. // should be contained in the key, not the value. For example, rather than
  65. // {"instanceLimit": "100/request"}, should be returned as,
  66. // {"instanceLimitPerRequest": "100"}, if the client exceeds the number of
  67. // instances that can be created in a single (batch) request.
  68. map<string, string> metadata = 3;
  69. }
  70. // Describes when the clients can retry a failed request. Clients could ignore
  71. // the recommendation here or retry when this information is missing from error
  72. // responses.
  73. //
  74. // It's always recommended that clients should use exponential backoff when
  75. // retrying.
  76. //
  77. // Clients should wait until `retry_delay` amount of time has passed since
  78. // receiving the error response before retrying. If retrying requests also
  79. // fail, clients should use an exponential backoff scheme to gradually increase
  80. // the delay between retries based on `retry_delay`, until either a maximum
  81. // number of retries have been reached or a maximum retry delay cap has been
  82. // reached.
  83. message RetryInfo {
  84. // Clients should wait at least this long between retrying the same request.
  85. google.protobuf.Duration retry_delay = 1;
  86. }
  87. // Describes additional debugging info.
  88. message DebugInfo {
  89. // The stack trace entries indicating where the error occurred.
  90. repeated string stack_entries = 1;
  91. // Additional debugging information provided by the server.
  92. string detail = 2;
  93. }
  94. // Describes how a quota check failed.
  95. //
  96. // For example if a daily limit was exceeded for the calling project,
  97. // a service could respond with a QuotaFailure detail containing the project
  98. // id and the description of the quota limit that was exceeded. If the
  99. // calling project hasn't enabled the service in the developer console, then
  100. // a service could respond with the project id and set `service_disabled`
  101. // to true.
  102. //
  103. // Also see RetryInfo and Help types for other details about handling a
  104. // quota failure.
  105. message QuotaFailure {
  106. // A message type used to describe a single quota violation. For example, a
  107. // daily quota or a custom quota that was exceeded.
  108. message Violation {
  109. // The subject on which the quota check failed.
  110. // For example, "clientip:<ip address of client>" or "project:<Google
  111. // developer project id>".
  112. string subject = 1;
  113. // A description of how the quota check failed. Clients can use this
  114. // description to find more about the quota configuration in the service's
  115. // public documentation, or find the relevant quota limit to adjust through
  116. // developer console.
  117. //
  118. // For example: "Service disabled" or "Daily Limit for read operations
  119. // exceeded".
  120. string description = 2;
  121. }
  122. // Describes all quota violations.
  123. repeated Violation violations = 1;
  124. }
  125. // Describes what preconditions have failed.
  126. //
  127. // For example, if an RPC failed because it required the Terms of Service to be
  128. // acknowledged, it could list the terms of service violation in the
  129. // PreconditionFailure message.
  130. message PreconditionFailure {
  131. // A message type used to describe a single precondition failure.
  132. message Violation {
  133. // The type of PreconditionFailure. We recommend using a service-specific
  134. // enum type to define the supported precondition violation subjects. For
  135. // example, "TOS" for "Terms of Service violation".
  136. string type = 1;
  137. // The subject, relative to the type, that failed.
  138. // For example, "google.com/cloud" relative to the "TOS" type would indicate
  139. // which terms of service is being referenced.
  140. string subject = 2;
  141. // A description of how the precondition failed. Developers can use this
  142. // description to understand how to fix the failure.
  143. //
  144. // For example: "Terms of service not accepted".
  145. string description = 3;
  146. }
  147. // Describes all precondition violations.
  148. repeated Violation violations = 1;
  149. }
  150. // Describes violations in a client request. This error type focuses on the
  151. // syntactic aspects of the request.
  152. message BadRequest {
  153. // A message type used to describe a single bad request field.
  154. message FieldViolation {
  155. // A path that leads to a field in the request body. The value will be a
  156. // sequence of dot-separated identifiers that identify a protocol buffer
  157. // field.
  158. //
  159. // Consider the following:
  160. //
  161. // message CreateContactRequest {
  162. // message EmailAddress {
  163. // enum Type {
  164. // TYPE_UNSPECIFIED = 0;
  165. // HOME = 1;
  166. // WORK = 2;
  167. // }
  168. //
  169. // optional string email = 1;
  170. // repeated EmailType type = 2;
  171. // }
  172. //
  173. // string full_name = 1;
  174. // repeated EmailAddress email_addresses = 2;
  175. // }
  176. //
  177. // In this example, in proto `field` could take one of the following values:
  178. //
  179. // * `full_name` for a violation in the `full_name` value
  180. // * `email_addresses[1].email` for a violation in the `email` field of the
  181. // first `email_addresses` message
  182. // * `email_addresses[3].type[2]` for a violation in the second `type`
  183. // value in the third `email_addresses` message.
  184. //
  185. // In JSON, the same values are represented as:
  186. //
  187. // * `fullName` for a violation in the `fullName` value
  188. // * `emailAddresses[1].email` for a violation in the `email` field of the
  189. // first `emailAddresses` message
  190. // * `emailAddresses[3].type[2]` for a violation in the second `type`
  191. // value in the third `emailAddresses` message.
  192. string field = 1;
  193. // A description of why the request element is bad.
  194. string description = 2;
  195. }
  196. // Describes all violations in a client request.
  197. repeated FieldViolation field_violations = 1;
  198. }
  199. // Contains metadata about the request that clients can attach when filing a bug
  200. // or providing other forms of feedback.
  201. message RequestInfo {
  202. // An opaque string that should only be interpreted by the service generating
  203. // it. For example, it can be used to identify requests in the service's logs.
  204. string request_id = 1;
  205. // Any data that was used to serve this request. For example, an encrypted
  206. // stack trace that can be sent back to the service provider for debugging.
  207. string serving_data = 2;
  208. }
  209. // Describes the resource that is being accessed.
  210. message ResourceInfo {
  211. // A name for the type of resource being accessed, e.g. "sql table",
  212. // "cloud storage bucket", "file", "Google calendar"; or the type URL
  213. // of the resource: e.g. "type.googleapis.com/google.pubsub.v1.Topic".
  214. string resource_type = 1;
  215. // The name of the resource being accessed. For example, a shared calendar
  216. // name: "example.com_4fghdhgsrgh@group.calendar.google.com", if the current
  217. // error is
  218. // [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED].
  219. string resource_name = 2;
  220. // The owner of the resource (optional).
  221. // For example, "user:<owner email>" or "project:<Google developer project
  222. // id>".
  223. string owner = 3;
  224. // Describes what error is encountered when accessing this resource.
  225. // For example, updating a cloud project may require the `writer` permission
  226. // on the developer console project.
  227. string description = 4;
  228. }
  229. // Provides links to documentation or for performing an out of band action.
  230. //
  231. // For example, if a quota check failed with an error indicating the calling
  232. // project hasn't enabled the accessed service, this can contain a URL pointing
  233. // directly to the right place in the developer console to flip the bit.
  234. message Help {
  235. // Describes a URL link.
  236. message Link {
  237. // Describes what the link offers.
  238. string description = 1;
  239. // The URL of the link.
  240. string url = 2;
  241. }
  242. // URL(s) pointing to additional information on handling the current error.
  243. repeated Link links = 1;
  244. }
  245. // Provides a localized error message that is safe to return to the user
  246. // which can be attached to an RPC error.
  247. message LocalizedMessage {
  248. // The locale used following the specification defined at
  249. // https://www.rfc-editor.org/rfc/bcp/bcp47.txt.
  250. // Examples are: "en-US", "fr-CH", "es-MX"
  251. string locale = 1;
  252. // The localized error message in the above locale.
  253. string message = 2;
  254. }