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