proto_types/rpc/google.rpc.rs
1// This file is @generated by prost-build.
2/// Describes the cause of the error with structured details.
3///
4/// Example of an error when contacting the "pubsub.googleapis.com" API when it
5/// is not enabled:
6/// ```json
7/// { "reason": "API_DISABLED"
8/// "domain": "googleapis.com"
9/// "metadata": {
10/// "resource": "projects/123",
11/// "service": "pubsub.googleapis.com"
12/// }
13/// }
14/// ```
15///
16/// This response indicates that the pubsub.googleapis.com API is not enabled.
17///
18/// Example of an error that is returned when attempting to create a Spanner
19/// instance in a region that is out of stock:
20/// ```json
21/// { "reason": "STOCKOUT"
22/// "domain": "spanner.googleapis.com",
23/// "metadata": {
24/// "availableRegions": "us-central1,us-east2"
25/// }
26/// }
27/// ```
28#[derive(Clone, PartialEq, Eq, ::prost::Message)]
29#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
30pub struct ErrorInfo {
31 /// The reason of the error. This is a constant value that identifies the
32 /// proximate cause of the error. Error reasons are unique within a particular
33 /// domain of errors. This should be at most 63 characters and match a
34 /// regular expression of `[A-Z][A-Z0-9_]+\[A-Z0-9\]`, which represents
35 /// UPPER_SNAKE_CASE.
36 #[prost(string, tag = "1")]
37 pub reason: ::prost::alloc::string::String,
38 /// The logical grouping to which the "reason" belongs. The error domain
39 /// is typically the registered service name of the tool or product that
40 /// generates the error. Example: "pubsub.googleapis.com". If the error is
41 /// generated by some common infrastructure, the error domain must be a
42 /// globally unique value that identifies the infrastructure. For Google API
43 /// infrastructure, the error domain is "googleapis.com".
44 #[prost(string, tag = "2")]
45 pub domain: ::prost::alloc::string::String,
46 /// Additional structured details about this error.
47 ///
48 /// Keys must match a regular expression of `[a-z][a-zA-Z0-9-_]+` but should
49 /// ideally be lowerCamelCase. Also, they must be limited to 64 characters in
50 /// length. When identifying the current value of an exceeded limit, the units
51 /// should be contained in the key, not the value. For example, rather than
52 /// `{"instanceLimit": "100/request"}`, should be returned as,
53 /// `{"instanceLimitPerRequest": "100"}`, if the client exceeds the number of
54 /// instances that can be created in a single (batch) request.
55 #[prost(map = "string, string", tag = "3")]
56 pub metadata:
57 ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
58}
59/// Describes when the clients can retry a failed request. Clients could ignore
60/// the recommendation here or retry when this information is missing from error
61/// responses.
62///
63/// It's always recommended that clients should use exponential backoff when
64/// retrying.
65///
66/// Clients should wait until `retry_delay` amount of time has passed since
67/// receiving the error response before retrying. If retrying requests also
68/// fail, clients should use an exponential backoff scheme to gradually increase
69/// the delay between retries based on `retry_delay`, until either a maximum
70/// number of retries have been reached or a maximum retry delay cap has been
71/// reached.
72#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
73#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
74#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
75pub struct RetryInfo {
76 /// Clients should wait at least this long between retrying the same request.
77 #[prost(message, optional, tag = "1")]
78 pub retry_delay: ::core::option::Option<crate::protobuf::Duration>,
79}
80/// Describes additional debugging info.
81#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
82#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
83#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
84pub struct DebugInfo {
85 /// The stack trace entries indicating where the error occurred.
86 #[prost(string, repeated, tag = "1")]
87 pub stack_entries: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
88 /// Additional debugging information provided by the server.
89 #[prost(string, tag = "2")]
90 pub detail: ::prost::alloc::string::String,
91}
92/// Describes how a quota check failed.
93///
94/// For example if a daily limit was exceeded for the calling project,
95/// a service could respond with a QuotaFailure detail containing the project
96/// id and the description of the quota limit that was exceeded. If the
97/// calling project hasn't enabled the service in the developer console, then
98/// a service could respond with the project id and set `service_disabled`
99/// to true.
100///
101/// Also see RetryInfo and Help types for other details about handling a
102/// quota failure.
103#[derive(Clone, PartialEq, Eq, ::prost::Message)]
104#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
105pub struct QuotaFailure {
106 /// Describes all quota violations.
107 #[prost(message, repeated, tag = "1")]
108 pub violations: ::prost::alloc::vec::Vec<quota_failure::Violation>,
109}
110/// Nested message and enum types in `QuotaFailure`.
111pub mod quota_failure {
112 /// A message type used to describe a single quota violation. For example, a
113 /// daily quota or a custom quota that was exceeded.
114 #[derive(Clone, PartialEq, Eq, ::prost::Message)]
115 #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
116 #[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
117 pub struct Violation {
118 /// The subject on which the quota check failed.
119 /// For example, "clientip:<ip address of client>" or "project:<Google
120 /// developer project id>".
121 #[prost(string, tag = "1")]
122 pub subject: ::prost::alloc::string::String,
123 /// A description of how the quota check failed. Clients can use this
124 /// description to find more about the quota configuration in the service's
125 /// public documentation, or find the relevant quota limit to adjust through
126 /// developer console.
127 ///
128 /// For example: "Service disabled" or "Daily Limit for read operations
129 /// exceeded".
130 #[prost(string, tag = "2")]
131 pub description: ::prost::alloc::string::String,
132 /// The API Service from which the `QuotaFailure.Violation` orginates. In
133 /// some cases, Quota issues originate from an API Service other than the one
134 /// that was called. In other words, a dependency of the called API Service
135 /// could be the cause of the `QuotaFailure`, and this field would have the
136 /// dependency API service name.
137 ///
138 /// For example, if the called API is Kubernetes Engine API
139 /// (container.googleapis.com), and a quota violation occurs in the
140 /// Kubernetes Engine API itself, this field would be
141 /// "container.googleapis.com". On the other hand, if the quota violation
142 /// occurs when the Kubernetes Engine API creates VMs in the Compute Engine
143 /// API (compute.googleapis.com), this field would be
144 /// "compute.googleapis.com".
145 #[prost(string, tag = "3")]
146 pub api_service: ::prost::alloc::string::String,
147 /// The metric of the violated quota. A quota metric is a named counter to
148 /// measure usage, such as API requests or CPUs. When an activity occurs in a
149 /// service, such as Virtual Machine allocation, one or more quota metrics
150 /// may be affected.
151 ///
152 /// For example, "compute.googleapis.com/cpus_per_vm_family",
153 /// "storage.googleapis.com/internet_egress_bandwidth".
154 #[prost(string, tag = "4")]
155 pub quota_metric: ::prost::alloc::string::String,
156 /// The id of the violated quota. Also know as "limit name", this is the
157 /// unique identifier of a quota in the context of an API service.
158 ///
159 /// For example, "CPUS-PER-VM-FAMILY-per-project-region".
160 #[prost(string, tag = "5")]
161 pub quota_id: ::prost::alloc::string::String,
162 /// The dimensions of the violated quota. Every non-global quota is enforced
163 /// on a set of dimensions. While quota metric defines what to count, the
164 /// dimensions specify for what aspects the counter should be increased.
165 ///
166 /// For example, the quota "CPUs per region per VM family" enforces a limit
167 /// on the metric "compute.googleapis.com/cpus_per_vm_family" on dimensions
168 /// "region" and "vm_family". And if the violation occurred in region
169 /// "us-central1" and for VM family "n1", the quota_dimensions would be,
170 ///
171 /// {
172 /// "region": "us-central1",
173 /// "vm_family": "n1",
174 /// }
175 ///
176 /// When a quota is enforced globally, the quota_dimensions would always be
177 /// empty.
178 #[prost(map = "string, string", tag = "6")]
179 pub quota_dimensions:
180 ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
181 /// The enforced quota value at the time of the `QuotaFailure`.
182 ///
183 /// For example, if the enforced quota value at the time of the
184 /// `QuotaFailure` on the number of CPUs is "10", then the value of this
185 /// field would reflect this quantity.
186 #[prost(int64, tag = "7")]
187 pub quota_value: i64,
188 /// The new quota value being rolled out at the time of the violation. At the
189 /// completion of the rollout, this value will be enforced in place of
190 /// quota_value. If no rollout is in progress at the time of the violation,
191 /// this field is not set.
192 ///
193 /// For example, if at the time of the violation a rollout is in progress
194 /// changing the number of CPUs quota from 10 to 20, 20 would be the value of
195 /// this field.
196 #[prost(int64, optional, tag = "8")]
197 pub future_quota_value: ::core::option::Option<i64>,
198 }
199}
200/// Describes what preconditions have failed.
201///
202/// For example, if an RPC failed because it required the Terms of Service to be
203/// acknowledged, it could list the terms of service violation in the
204/// PreconditionFailure message.
205#[derive(Clone, PartialEq, Eq, ::prost::Message)]
206#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
207pub struct PreconditionFailure {
208 /// Describes all precondition violations.
209 #[prost(message, repeated, tag = "1")]
210 pub violations: ::prost::alloc::vec::Vec<precondition_failure::Violation>,
211}
212/// Nested message and enum types in `PreconditionFailure`.
213pub mod precondition_failure {
214 /// A message type used to describe a single precondition failure.
215 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
216 #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
217 pub struct Violation {
218 /// The type of PreconditionFailure. We recommend using a service-specific
219 /// enum type to define the supported precondition violation subjects. For
220 /// example, "TOS" for "Terms of Service violation".
221 #[prost(string, tag = "1")]
222 pub r#type: ::prost::alloc::string::String,
223 /// The subject, relative to the type, that failed.
224 /// For example, "google.com/cloud" relative to the "TOS" type would indicate
225 /// which terms of service is being referenced.
226 #[prost(string, tag = "2")]
227 pub subject: ::prost::alloc::string::String,
228 /// A description of how the precondition failed. Developers can use this
229 /// description to understand how to fix the failure.
230 ///
231 /// For example: "Terms of service not accepted".
232 #[prost(string, tag = "3")]
233 pub description: ::prost::alloc::string::String,
234 }
235}
236/// Describes violations in a client request. This error type focuses on the
237/// syntactic aspects of the request.
238#[derive(Clone, PartialEq, Eq, ::prost::Message)]
239#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
240#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
241pub struct BadRequest {
242 /// Describes all violations in a client request.
243 #[prost(message, repeated, tag = "1")]
244 pub field_violations: ::prost::alloc::vec::Vec<bad_request::FieldViolation>,
245}
246/// Nested message and enum types in `BadRequest`.
247pub mod bad_request {
248 /// A message type used to describe a single bad request field.
249 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
250 #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
251 #[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
252 pub struct FieldViolation {
253 /// A path that leads to a field in the request body. The value will be a
254 /// sequence of dot-separated identifiers that identify a protocol buffer
255 /// field.
256 ///
257 /// Consider the following:
258 /// ```proto
259 /// message CreateContactRequest {
260 /// message EmailAddress {
261 /// enum Type {
262 /// TYPE_UNSPECIFIED = 0;
263 /// HOME = 1;
264 /// WORK = 2;
265 /// }
266 ///
267 /// optional string email = 1;
268 /// repeated EmailType type = 2;
269 /// }
270 ///
271 /// string full_name = 1;
272 /// repeated EmailAddress email_addresses = 2;
273 /// }
274 /// ```
275 ///
276 /// In this example, in proto `field` could take one of the following values:
277 ///
278 /// * `full_name` for a violation in the `full_name` value
279 /// * `email_addresses\[1\].email` for a violation in the `email` field of the
280 /// first `email_addresses` message
281 /// * `email_addresses\[3\].type\[2\]` for a violation in the second `type`
282 /// value in the third `email_addresses` message.
283 ///
284 /// In JSON, the same values are represented as:
285 ///
286 /// * `fullName` for a violation in the `fullName` value
287 /// * `emailAddresses\[1\].email` for a violation in the `email` field of the
288 /// first `emailAddresses` message
289 /// * `emailAddresses\[3\].type\[2\]` for a violation in the second `type`
290 /// value in the third `emailAddresses` message.
291 #[prost(string, tag = "1")]
292 pub field: ::prost::alloc::string::String,
293 /// A description of why the request element is bad.
294 #[prost(string, tag = "2")]
295 pub description: ::prost::alloc::string::String,
296 /// The reason of the field-level error. This is a constant value that
297 /// identifies the proximate cause of the field-level error. It should
298 /// uniquely identify the type of the FieldViolation within the scope of the
299 /// google.rpc.ErrorInfo.domain. This should be at most 63
300 /// characters and match a regular expression of `[A-Z][A-Z0-9_]+\[A-Z0-9\]`,
301 /// which represents UPPER_SNAKE_CASE.
302 #[prost(string, tag = "3")]
303 pub reason: ::prost::alloc::string::String,
304 /// Provides a localized error message for field-level errors that is safe to
305 /// return to the API consumer.
306 #[prost(message, optional, tag = "4")]
307 pub localized_message: ::core::option::Option<super::LocalizedMessage>,
308 }
309}
310/// Contains metadata about the request that clients can attach when filing a bug
311/// or providing other forms of feedback.
312#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
313#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
314#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
315pub struct RequestInfo {
316 /// An opaque string that should only be interpreted by the service generating
317 /// it. For example, it can be used to identify requests in the service's logs.
318 #[prost(string, tag = "1")]
319 pub request_id: ::prost::alloc::string::String,
320 /// Any data that was used to serve this request. For example, an encrypted
321 /// stack trace that can be sent back to the service provider for debugging.
322 #[prost(string, tag = "2")]
323 pub serving_data: ::prost::alloc::string::String,
324}
325/// Describes the resource that is being accessed.
326#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
327#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
328#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
329pub struct ResourceInfo {
330 /// A name for the type of resource being accessed, e.g. "sql table",
331 /// "cloud storage bucket", "file", "Google calendar"; or the type URL
332 /// of the resource: e.g. "type.googleapis.com/google.pubsub.v1.Topic".
333 #[prost(string, tag = "1")]
334 pub resource_type: ::prost::alloc::string::String,
335 /// The name of the resource being accessed. For example, a shared calendar
336 /// name: "example.com_4fghdhgsrgh@group.calendar.google.com", if the current
337 /// error is
338 /// [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED].
339 #[prost(string, tag = "2")]
340 pub resource_name: ::prost::alloc::string::String,
341 /// The owner of the resource (optional).
342 /// For example, "user:<owner email>" or "project:<Google developer project
343 /// id>".
344 #[prost(string, tag = "3")]
345 pub owner: ::prost::alloc::string::String,
346 /// Describes what error is encountered when accessing this resource.
347 /// For example, updating a cloud project may require the `writer` permission
348 /// on the developer console project.
349 #[prost(string, tag = "4")]
350 pub description: ::prost::alloc::string::String,
351}
352/// Provides links to documentation or for performing an out of band action.
353///
354/// For example, if a quota check failed with an error indicating the calling
355/// project hasn't enabled the accessed service, this can contain a URL pointing
356/// directly to the right place in the developer console to flip the bit.
357#[derive(Clone, PartialEq, Eq, ::prost::Message)]
358#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
359pub struct Help {
360 /// URL(s) pointing to additional information on handling the current error.
361 #[prost(message, repeated, tag = "1")]
362 pub links: ::prost::alloc::vec::Vec<help::Link>,
363}
364/// Nested message and enum types in `Help`.
365pub mod help {
366 /// Describes a URL link.
367 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
368 #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
369 pub struct Link {
370 /// Describes what the link offers.
371 #[prost(string, tag = "1")]
372 pub description: ::prost::alloc::string::String,
373 /// The URL of the link.
374 #[prost(string, tag = "2")]
375 pub url: ::prost::alloc::string::String,
376 }
377}
378/// Provides a localized error message that is safe to return to the user
379/// which can be attached to an RPC error.
380#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
381#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
382pub struct LocalizedMessage {
383 /// The locale used following the specification defined at
384 /// <https://www.rfc-editor.org/rfc/bcp/bcp47.txt.>
385 /// Examples are: "en-US", "fr-CH", "es-MX"
386 #[prost(string, tag = "1")]
387 pub locale: ::prost::alloc::string::String,
388 /// The localized error message in the above locale.
389 #[prost(string, tag = "2")]
390 pub message: ::prost::alloc::string::String,
391}
392/// Represents an HTTP request.
393#[derive(Clone, PartialEq, Eq, ::prost::Message)]
394#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
395pub struct HttpRequest {
396 /// The HTTP request method.
397 #[prost(string, tag = "1")]
398 pub method: ::prost::alloc::string::String,
399 /// The HTTP request URI.
400 #[prost(string, tag = "2")]
401 pub uri: ::prost::alloc::string::String,
402 /// The HTTP request headers. The ordering of the headers is significant.
403 /// Multiple headers with the same key may present for the request.
404 #[prost(message, repeated, tag = "3")]
405 pub headers: ::prost::alloc::vec::Vec<HttpHeader>,
406 /// The HTTP request body. If the body is not expected, it should be empty.
407 #[prost(bytes = "bytes", tag = "4")]
408 pub body: ::prost::bytes::Bytes,
409}
410
411/// Represents an HTTP response.
412#[derive(Clone, PartialEq, Eq, ::prost::Message)]
413#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
414pub struct HttpResponse {
415 /// The HTTP status code, such as 200 or 404.
416 #[prost(int32, tag = "1")]
417 pub status: i32,
418 /// The HTTP reason phrase, such as "OK" or "Not Found".
419 #[prost(string, tag = "2")]
420 pub reason: ::prost::alloc::string::String,
421 /// The HTTP response headers. The ordering of the headers is significant.
422 /// Multiple headers with the same key may present for the response.
423 #[prost(message, repeated, tag = "3")]
424 pub headers: ::prost::alloc::vec::Vec<HttpHeader>,
425 /// The HTTP response body. If the body is not expected, it should be empty.
426 #[prost(bytes = "bytes", tag = "4")]
427 pub body: ::prost::bytes::Bytes,
428}
429
430/// Represents an HTTP header.
431#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
432#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
433pub struct HttpHeader {
434 /// The HTTP header key. It is case insensitive.
435 #[prost(string, tag = "1")]
436 pub key: ::prost::alloc::string::String,
437 /// The HTTP header value.
438 #[prost(string, tag = "2")]
439 pub value: ::prost::alloc::string::String,
440}