error_details.proto 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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. 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 when the clients can retry a failed request. Clients could ignore
  23. // the recommendation here or retry when this information is missing from error
  24. // responses.
  25. //
  26. // It's always recommended that clients should use exponential backoff when
  27. // retrying.
  28. //
  29. // Clients should wait until `retry_delay` amount of time has passed since
  30. // receiving the error response before retrying. If retrying requests also
  31. // fail, clients should use an exponential backoff scheme to gradually increase
  32. // the delay between retries based on `retry_delay`, until either a maximum
  33. // number of retires have been reached or a maximum retry delay cap has been
  34. // reached.
  35. message RetryInfo {
  36. // Clients should wait at least this long between retrying the same request.
  37. google.protobuf.Duration retry_delay = 1;
  38. }
  39. // Describes additional debugging info.
  40. message DebugInfo {
  41. // The stack trace entries indicating where the error occurred.
  42. repeated string stack_entries = 1;
  43. // Additional debugging information provided by the server.
  44. string detail = 2;
  45. }
  46. // Describes how a quota check failed.
  47. //
  48. // For example if a daily limit was exceeded for the calling project,
  49. // a service could respond with a QuotaFailure detail containing the project
  50. // id and the description of the quota limit that was exceeded. If the
  51. // calling project hasn't enabled the service in the developer console, then
  52. // a service could respond with the project id and set `service_disabled`
  53. // to true.
  54. //
  55. // Also see RetryDetail and Help types for other details about handling a
  56. // quota failure.
  57. message QuotaFailure {
  58. // A message type used to describe a single quota violation. For example, a
  59. // daily quota or a custom quota that was exceeded.
  60. message Violation {
  61. // The subject on which the quota check failed.
  62. // For example, "clientip:<ip address of client>" or "project:<Google
  63. // developer project id>".
  64. string subject = 1;
  65. // A description of how the quota check failed. Clients can use this
  66. // description to find more about the quota configuration in the service's
  67. // public documentation, or find the relevant quota limit to adjust through
  68. // developer console.
  69. //
  70. // For example: "Service disabled" or "Daily Limit for read operations
  71. // exceeded".
  72. string description = 2;
  73. }
  74. // Describes all quota violations.
  75. repeated Violation violations = 1;
  76. }
  77. // Describes what preconditions have failed.
  78. //
  79. // For example, if an RPC failed because it required the Terms of Service to be
  80. // acknowledged, it could list the terms of service violation in the
  81. // PreconditionFailure message.
  82. message PreconditionFailure {
  83. // A message type used to describe a single precondition failure.
  84. message Violation {
  85. // The type of PreconditionFailure. We recommend using a service-specific
  86. // enum type to define the supported precondition violation types. For
  87. // example, "TOS" for "Terms of Service violation".
  88. string type = 1;
  89. // The subject, relative to the type, that failed.
  90. // For example, "google.com/cloud" relative to the "TOS" type would
  91. // indicate which terms of service is being referenced.
  92. string subject = 2;
  93. // A description of how the precondition failed. Developers can use this
  94. // description to understand how to fix the failure.
  95. //
  96. // For example: "Terms of service not accepted".
  97. string description = 3;
  98. }
  99. // Describes all precondition violations.
  100. repeated Violation violations = 1;
  101. }
  102. // Describes violations in a client request. This error type focuses on the
  103. // syntactic aspects of the request.
  104. message BadRequest {
  105. // A message type used to describe a single bad request field.
  106. message FieldViolation {
  107. // A path leading to a field in the request body. The value will be a
  108. // sequence of dot-separated identifiers that identify a protocol buffer
  109. // field. E.g., "field_violations.field" would identify this field.
  110. string field = 1;
  111. // A description of why the request element is bad.
  112. string description = 2;
  113. }
  114. // Describes all violations in a client request.
  115. repeated FieldViolation field_violations = 1;
  116. }
  117. // Contains metadata about the request that clients can attach when filing a bug
  118. // or providing other forms of feedback.
  119. message RequestInfo {
  120. // An opaque string that should only be interpreted by the service generating
  121. // it. For example, it can be used to identify requests in the service's logs.
  122. string request_id = 1;
  123. // Any data that was used to serve this request. For example, an encrypted
  124. // stack trace that can be sent back to the service provider for debugging.
  125. string serving_data = 2;
  126. }
  127. // Describes the resource that is being accessed.
  128. message ResourceInfo {
  129. // A name for the type of resource being accessed, e.g. "sql table",
  130. // "cloud storage bucket", "file", "Google calendar"; or the type URL
  131. // of the resource: e.g. "type.googleapis.com/google.pubsub.v1.Topic".
  132. string resource_type = 1;
  133. // The name of the resource being accessed. For example, a shared calendar
  134. // name: "example.com_4fghdhgsrgh@group.calendar.google.com", if the current
  135. // error is [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED].
  136. string resource_name = 2;
  137. // The owner of the resource (optional).
  138. // For example, "user:<owner email>" or "project:<Google developer project
  139. // id>".
  140. string owner = 3;
  141. // Describes what error is encountered when accessing this resource.
  142. // For example, updating a cloud project may require the `writer` permission
  143. // on the developer console project.
  144. string description = 4;
  145. }
  146. // Provides links to documentation or for performing an out of band action.
  147. //
  148. // For example, if a quota check failed with an error indicating the calling
  149. // project hasn't enabled the accessed service, this can contain a URL pointing
  150. // directly to the right place in the developer console to flip the bit.
  151. message Help {
  152. // Describes a URL link.
  153. message Link {
  154. // Describes what the link offers.
  155. string description = 1;
  156. // The URL of the link.
  157. string url = 2;
  158. }
  159. // URL(s) pointing to additional information on handling the current error.
  160. repeated Link links = 1;
  161. }
  162. // Provides a localized error message that is safe to return to the user
  163. // which can be attached to an RPC error.
  164. message LocalizedMessage {
  165. // The locale used following the specification defined at
  166. // http://www.rfc-editor.org/rfc/bcp/bcp47.txt.
  167. // Examples are: "en-US", "fr-CH", "es-MX"
  168. string locale = 1;
  169. // The localized error message in the above locale.
  170. string message = 2;
  171. }