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