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///
7///      { "reason": "API_DISABLED"
8///        "domain": "googleapis.com"
9///        "metadata": {
10///          "resource": "projects/123",
11///          "service": "pubsub.googleapis.com"
12///        }
13///      }
14///
15/// This response indicates that the pubsub.googleapis.com API is not enabled.
16///
17/// Example of an error that is returned when attempting to create a Spanner
18/// instance in a region that is out of stock:
19///
20///      { "reason": "STOCKOUT"
21///        "domain": "spanner.googleapis.com",
22///        "metadata": {
23///          "availableRegions": "us-central1,us-east2"
24///        }
25///      }
26#[derive(Clone, PartialEq, ::prost::Message)]
27#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
28pub struct ErrorInfo {
29  /// The reason of the error. This is a constant value that identifies the
30  /// proximate cause of the error. Error reasons are unique within a particular
31  /// domain of errors. This should be at most 63 characters and match a
32  /// regular expression of `[A-Z][A-Z0-9_]+\[A-Z0-9\]`, which represents
33  /// UPPER_SNAKE_CASE.
34  #[prost(string, tag = "1")]
35  pub reason: ::prost::alloc::string::String,
36  /// The logical grouping to which the "reason" belongs. The error domain
37  /// is typically the registered service name of the tool or product that
38  /// generates the error. Example: "pubsub.googleapis.com". If the error is
39  /// generated by some common infrastructure, the error domain must be a
40  /// globally unique value that identifies the infrastructure. For Google API
41  /// infrastructure, the error domain is "googleapis.com".
42  #[prost(string, tag = "2")]
43  pub domain: ::prost::alloc::string::String,
44  /// Additional structured details about this error.
45  ///
46  /// Keys must match a regular expression of `[a-z][a-zA-Z0-9-_]+` but should
47  /// ideally be lowerCamelCase. Also, they must be limited to 64 characters in
48  /// length. When identifying the current value of an exceeded limit, the units
49  /// should be contained in the key, not the value.  For example, rather than
50  /// `{"instanceLimit": "100/request"}`, should be returned as,
51  /// `{"instanceLimitPerRequest": "100"}`, if the client exceeds the number of
52  /// instances that can be created in a single (batch) request.
53  #[prost(map = "string, string", tag = "3")]
54  pub metadata:
55    ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
56}
57/// Describes when the clients can retry a failed request. Clients could ignore
58/// the recommendation here or retry when this information is missing from error
59/// responses.
60///
61/// It's always recommended that clients should use exponential backoff when
62/// retrying.
63///
64/// Clients should wait until `retry_delay` amount of time has passed since
65/// receiving the error response before retrying.  If retrying requests also
66/// fail, clients should use an exponential backoff scheme to gradually increase
67/// the delay between retries based on `retry_delay`, until either a maximum
68/// number of retries have been reached or a maximum retry delay cap has been
69/// reached.
70#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
71#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
72#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
73pub struct RetryInfo {
74  /// Clients should wait at least this long between retrying the same request.
75  #[prost(message, optional, tag = "1")]
76  pub retry_delay: ::core::option::Option<crate::protobuf::Duration>,
77}
78/// Describes additional debugging info.
79#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
80#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
81#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
82pub struct DebugInfo {
83  /// The stack trace entries indicating where the error occurred.
84  #[prost(string, repeated, tag = "1")]
85  pub stack_entries: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
86  /// Additional debugging information provided by the server.
87  #[prost(string, tag = "2")]
88  pub detail: ::prost::alloc::string::String,
89}
90/// Describes how a quota check failed.
91///
92/// For example if a daily limit was exceeded for the calling project,
93/// a service could respond with a QuotaFailure detail containing the project
94/// id and the description of the quota limit that was exceeded.  If the
95/// calling project hasn't enabled the service in the developer console, then
96/// a service could respond with the project id and set `service_disabled`
97/// to true.
98///
99/// Also see RetryInfo and Help types for other details about handling a
100/// quota failure.
101#[derive(Clone, PartialEq, ::prost::Message)]
102#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
103pub struct QuotaFailure {
104  /// Describes all quota violations.
105  #[prost(message, repeated, tag = "1")]
106  pub violations: ::prost::alloc::vec::Vec<quota_failure::Violation>,
107}
108/// Nested message and enum types in `QuotaFailure`.
109pub mod quota_failure {
110  /// A message type used to describe a single quota violation.  For example, a
111  /// daily quota or a custom quota that was exceeded.
112  #[derive(Clone, PartialEq, ::prost::Message)]
113  #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
114  #[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
115  pub struct Violation {
116    /// The subject on which the quota check failed.
117    /// For example, "clientip:<ip address of client>" or "project:<Google
118    /// developer project id>".
119    #[prost(string, tag = "1")]
120    pub subject: ::prost::alloc::string::String,
121    /// A description of how the quota check failed. Clients can use this
122    /// description to find more about the quota configuration in the service's
123    /// public documentation, or find the relevant quota limit to adjust through
124    /// developer console.
125    ///
126    /// For example: "Service disabled" or "Daily Limit for read operations
127    /// exceeded".
128    #[prost(string, tag = "2")]
129    pub description: ::prost::alloc::string::String,
130    /// The API Service from which the `QuotaFailure.Violation` orginates. In
131    /// some cases, Quota issues originate from an API Service other than the one
132    /// that was called. In other words, a dependency of the called API Service
133    /// could be the cause of the `QuotaFailure`, and this field would have the
134    /// dependency API service name.
135    ///
136    /// For example, if the called API is Kubernetes Engine API
137    /// (container.googleapis.com), and a quota violation occurs in the
138    /// Kubernetes Engine API itself, this field would be
139    /// "container.googleapis.com". On the other hand, if the quota violation
140    /// occurs when the Kubernetes Engine API creates VMs in the Compute Engine
141    /// API (compute.googleapis.com), this field would be
142    /// "compute.googleapis.com".
143    #[prost(string, tag = "3")]
144    pub api_service: ::prost::alloc::string::String,
145    /// The metric of the violated quota. A quota metric is a named counter to
146    /// measure usage, such as API requests or CPUs. When an activity occurs in a
147    /// service, such as Virtual Machine allocation, one or more quota metrics
148    /// may be affected.
149    ///
150    /// For example, "compute.googleapis.com/cpus_per_vm_family",
151    /// "storage.googleapis.com/internet_egress_bandwidth".
152    #[prost(string, tag = "4")]
153    pub quota_metric: ::prost::alloc::string::String,
154    /// The id of the violated quota. Also know as "limit name", this is the
155    /// unique identifier of a quota in the context of an API service.
156    ///
157    /// For example, "CPUS-PER-VM-FAMILY-per-project-region".
158    #[prost(string, tag = "5")]
159    pub quota_id: ::prost::alloc::string::String,
160    /// The dimensions of the violated quota. Every non-global quota is enforced
161    /// on a set of dimensions. While quota metric defines what to count, the
162    /// dimensions specify for what aspects the counter should be increased.
163    ///
164    /// For example, the quota "CPUs per region per VM family" enforces a limit
165    /// on the metric "compute.googleapis.com/cpus_per_vm_family" on dimensions
166    /// "region" and "vm_family". And if the violation occurred in region
167    /// "us-central1" and for VM family "n1", the quota_dimensions would be,
168    ///
169    /// {
170    ///    "region": "us-central1",
171    ///    "vm_family": "n1",
172    /// }
173    ///
174    /// When a quota is enforced globally, the quota_dimensions would always be
175    /// empty.
176    #[prost(map = "string, string", tag = "6")]
177    pub quota_dimensions:
178      ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
179    /// The enforced quota value at the time of the `QuotaFailure`.
180    ///
181    /// For example, if the enforced quota value at the time of the
182    /// `QuotaFailure` on the number of CPUs is "10", then the value of this
183    /// field would reflect this quantity.
184    #[prost(int64, tag = "7")]
185    pub quota_value: i64,
186    /// The new quota value being rolled out at the time of the violation. At the
187    /// completion of the rollout, this value will be enforced in place of
188    /// quota_value. If no rollout is in progress at the time of the violation,
189    /// this field is not set.
190    ///
191    /// For example, if at the time of the violation a rollout is in progress
192    /// changing the number of CPUs quota from 10 to 20, 20 would be the value of
193    /// this field.
194    #[prost(int64, optional, tag = "8")]
195    pub future_quota_value: ::core::option::Option<i64>,
196  }
197}
198/// Describes what preconditions have failed.
199///
200/// For example, if an RPC failed because it required the Terms of Service to be
201/// acknowledged, it could list the terms of service violation in the
202/// PreconditionFailure message.
203#[derive(Clone, PartialEq, ::prost::Message)]
204#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
205pub struct PreconditionFailure {
206  /// Describes all precondition violations.
207  #[prost(message, repeated, tag = "1")]
208  pub violations: ::prost::alloc::vec::Vec<precondition_failure::Violation>,
209}
210/// Nested message and enum types in `PreconditionFailure`.
211pub mod precondition_failure {
212  /// A message type used to describe a single precondition failure.
213  #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
214  #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
215  pub struct Violation {
216    /// The type of PreconditionFailure. We recommend using a service-specific
217    /// enum type to define the supported precondition violation subjects. For
218    /// example, "TOS" for "Terms of Service violation".
219    #[prost(string, tag = "1")]
220    pub r#type: ::prost::alloc::string::String,
221    /// The subject, relative to the type, that failed.
222    /// For example, "google.com/cloud" relative to the "TOS" type would indicate
223    /// which terms of service is being referenced.
224    #[prost(string, tag = "2")]
225    pub subject: ::prost::alloc::string::String,
226    /// A description of how the precondition failed. Developers can use this
227    /// description to understand how to fix the failure.
228    ///
229    /// For example: "Terms of service not accepted".
230    #[prost(string, tag = "3")]
231    pub description: ::prost::alloc::string::String,
232  }
233}
234/// Describes violations in a client request. This error type focuses on the
235/// syntactic aspects of the request.
236#[derive(Clone, PartialEq, ::prost::Message)]
237#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
238#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
239pub struct BadRequest {
240  /// Describes all violations in a client request.
241  #[prost(message, repeated, tag = "1")]
242  pub field_violations: ::prost::alloc::vec::Vec<bad_request::FieldViolation>,
243}
244/// Nested message and enum types in `BadRequest`.
245pub mod bad_request {
246  /// A message type used to describe a single bad request field.
247  #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
248  #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
249  #[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
250  pub struct FieldViolation {
251    /// A path that leads to a field in the request body. The value will be a
252    /// sequence of dot-separated identifiers that identify a protocol buffer
253    /// field.
254    ///
255    /// Consider the following:
256    ///
257    ///      message CreateContactRequest {
258    ///        message EmailAddress {
259    ///          enum Type {
260    ///            TYPE_UNSPECIFIED = 0;
261    ///            HOME = 1;
262    ///            WORK = 2;
263    ///          }
264    ///
265    ///          optional string email = 1;
266    ///          repeated EmailType type = 2;
267    ///        }
268    ///
269    ///        string full_name = 1;
270    ///        repeated EmailAddress email_addresses = 2;
271    ///      }
272    ///
273    /// In this example, in proto `field` could take one of the following values:
274    ///
275    /// * `full_name` for a violation in the `full_name` value
276    /// * `email_addresses\[1\].email` for a violation in the `email` field of the
277    ///    first `email_addresses` message
278    /// * `email_addresses\[3\].type\[2\]` for a violation in the second `type`
279    ///    value in the third `email_addresses` message.
280    ///
281    /// In JSON, the same values are represented as:
282    ///
283    /// * `fullName` for a violation in the `fullName` value
284    /// * `emailAddresses\[1\].email` for a violation in the `email` field of the
285    ///    first `emailAddresses` message
286    /// * `emailAddresses\[3\].type\[2\]` for a violation in the second `type`
287    ///    value in the third `emailAddresses` message.
288    #[prost(string, tag = "1")]
289    pub field: ::prost::alloc::string::String,
290    /// A description of why the request element is bad.
291    #[prost(string, tag = "2")]
292    pub description: ::prost::alloc::string::String,
293    /// The reason of the field-level error. This is a constant value that
294    /// identifies the proximate cause of the field-level error. It should
295    /// uniquely identify the type of the FieldViolation within the scope of the
296    /// google.rpc.ErrorInfo.domain. This should be at most 63
297    /// characters and match a regular expression of `[A-Z][A-Z0-9_]+\[A-Z0-9\]`,
298    /// which represents UPPER_SNAKE_CASE.
299    #[prost(string, tag = "3")]
300    pub reason: ::prost::alloc::string::String,
301    /// Provides a localized error message for field-level errors that is safe to
302    /// return to the API consumer.
303    #[prost(message, optional, tag = "4")]
304    pub localized_message: ::core::option::Option<super::LocalizedMessage>,
305  }
306}
307/// Contains metadata about the request that clients can attach when filing a bug
308/// or providing other forms of feedback.
309#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
310#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
311#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
312pub struct RequestInfo {
313  /// An opaque string that should only be interpreted by the service generating
314  /// it. For example, it can be used to identify requests in the service's logs.
315  #[prost(string, tag = "1")]
316  pub request_id: ::prost::alloc::string::String,
317  /// Any data that was used to serve this request. For example, an encrypted
318  /// stack trace that can be sent back to the service provider for debugging.
319  #[prost(string, tag = "2")]
320  pub serving_data: ::prost::alloc::string::String,
321}
322/// Describes the resource that is being accessed.
323#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
324#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
325#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
326pub struct ResourceInfo {
327  /// A name for the type of resource being accessed, e.g. "sql table",
328  /// "cloud storage bucket", "file", "Google calendar"; or the type URL
329  /// of the resource: e.g. "type.googleapis.com/google.pubsub.v1.Topic".
330  #[prost(string, tag = "1")]
331  pub resource_type: ::prost::alloc::string::String,
332  /// The name of the resource being accessed.  For example, a shared calendar
333  /// name: "example.com_4fghdhgsrgh@group.calendar.google.com", if the current
334  /// error is
335  /// [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED].
336  #[prost(string, tag = "2")]
337  pub resource_name: ::prost::alloc::string::String,
338  /// The owner of the resource (optional).
339  /// For example, "user:<owner email>" or "project:<Google developer project
340  /// id>".
341  #[prost(string, tag = "3")]
342  pub owner: ::prost::alloc::string::String,
343  /// Describes what error is encountered when accessing this resource.
344  /// For example, updating a cloud project may require the `writer` permission
345  /// on the developer console project.
346  #[prost(string, tag = "4")]
347  pub description: ::prost::alloc::string::String,
348}
349/// Provides links to documentation or for performing an out of band action.
350///
351/// For example, if a quota check failed with an error indicating the calling
352/// project hasn't enabled the accessed service, this can contain a URL pointing
353/// directly to the right place in the developer console to flip the bit.
354#[derive(Clone, PartialEq, ::prost::Message)]
355#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
356pub struct Help {
357  /// URL(s) pointing to additional information on handling the current error.
358  #[prost(message, repeated, tag = "1")]
359  pub links: ::prost::alloc::vec::Vec<help::Link>,
360}
361/// Nested message and enum types in `Help`.
362pub mod help {
363  /// Describes a URL link.
364  #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
365  #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
366  pub struct Link {
367    /// Describes what the link offers.
368    #[prost(string, tag = "1")]
369    pub description: ::prost::alloc::string::String,
370    /// The URL of the link.
371    #[prost(string, tag = "2")]
372    pub url: ::prost::alloc::string::String,
373  }
374}
375/// Provides a localized error message that is safe to return to the user
376/// which can be attached to an RPC error.
377#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
378#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
379pub struct LocalizedMessage {
380  /// The locale used following the specification defined at
381  /// <https://www.rfc-editor.org/rfc/bcp/bcp47.txt.>
382  /// Examples are: "en-US", "fr-CH", "es-MX"
383  #[prost(string, tag = "1")]
384  pub locale: ::prost::alloc::string::String,
385  /// The localized error message in the above locale.
386  #[prost(string, tag = "2")]
387  pub message: ::prost::alloc::string::String,
388}
389/// Represents an HTTP request.
390#[derive(Clone, PartialEq, ::prost::Message)]
391#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
392pub struct HttpRequest {
393  /// The HTTP request method.
394  #[prost(string, tag = "1")]
395  pub method: ::prost::alloc::string::String,
396  /// The HTTP request URI.
397  #[prost(string, tag = "2")]
398  pub uri: ::prost::alloc::string::String,
399  /// The HTTP request headers. The ordering of the headers is significant.
400  /// Multiple headers with the same key may present for the request.
401  #[prost(message, repeated, tag = "3")]
402  pub headers: ::prost::alloc::vec::Vec<HttpHeader>,
403  /// The HTTP request body. If the body is not expected, it should be empty.
404  #[prost(bytes = "bytes", tag = "4")]
405  pub body: ::prost::bytes::Bytes,
406}
407
408/// Represents an HTTP response.
409#[derive(Clone, PartialEq, ::prost::Message)]
410#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
411pub struct HttpResponse {
412  /// The HTTP status code, such as 200 or 404.
413  #[prost(int32, tag = "1")]
414  pub status: i32,
415  /// The HTTP reason phrase, such as "OK" or "Not Found".
416  #[prost(string, tag = "2")]
417  pub reason: ::prost::alloc::string::String,
418  /// The HTTP response headers. The ordering of the headers is significant.
419  /// Multiple headers with the same key may present for the response.
420  #[prost(message, repeated, tag = "3")]
421  pub headers: ::prost::alloc::vec::Vec<HttpHeader>,
422  /// The HTTP response body. If the body is not expected, it should be empty.
423  #[prost(bytes = "bytes", tag = "4")]
424  pub body: ::prost::bytes::Bytes,
425}
426
427/// Represents an HTTP header.
428#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
429#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
430pub struct HttpHeader {
431  /// The HTTP header key. It is case insensitive.
432  #[prost(string, tag = "1")]
433  pub key: ::prost::alloc::string::String,
434  /// The HTTP header value.
435  #[prost(string, tag = "2")]
436  pub value: ::prost::alloc::string::String,
437}
438
439/// The canonical error codes for gRPC APIs.
440///
441///
442/// Sometimes multiple error codes may apply.  Services should return
443/// the most specific error code that applies.  For example, prefer
444/// `OUT_OF_RANGE` over `FAILED_PRECONDITION` if both codes apply.
445/// Similarly prefer `NOT_FOUND` or `ALREADY_EXISTS` over `FAILED_PRECONDITION`.
446#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
447#[repr(i32)]
448pub enum Code {
449  /// Not an error; returned on success.
450  ///
451  /// HTTP Mapping: 200 OK
452  Ok = 0,
453  /// The operation was cancelled, typically by the caller.
454  ///
455  /// HTTP Mapping: 499 Client Closed Request
456  Cancelled = 1,
457  /// Unknown error.  For example, this error may be returned when
458  /// a `Status` value received from another address space belongs to
459  /// an error space that is not known in this address space.  Also
460  /// errors raised by APIs that do not return enough error information
461  /// may be converted to this error.
462  ///
463  /// HTTP Mapping: 500 Internal Server Error
464  Unknown = 2,
465  /// The client specified an invalid argument.  Note that this differs
466  /// from `FAILED_PRECONDITION`.  `INVALID_ARGUMENT` indicates arguments
467  /// that are problematic regardless of the state of the system
468  /// (e.g., a malformed file name).
469  ///
470  /// HTTP Mapping: 400 Bad Request
471  InvalidArgument = 3,
472  /// The deadline expired before the operation could complete. For operations
473  /// that change the state of the system, this error may be returned
474  /// even if the operation has completed successfully.  For example, a
475  /// successful response from a server could have been delayed long
476  /// enough for the deadline to expire.
477  ///
478  /// HTTP Mapping: 504 Gateway Timeout
479  DeadlineExceeded = 4,
480  /// Some requested entity (e.g., file or directory) was not found.
481  ///
482  /// Note to server developers: if a request is denied for an entire class
483  /// of users, such as gradual feature rollout or undocumented allowlist,
484  /// `NOT_FOUND` may be used. If a request is denied for some users within
485  /// a class of users, such as user-based access control, `PERMISSION_DENIED`
486  /// must be used.
487  ///
488  /// HTTP Mapping: 404 Not Found
489  NotFound = 5,
490  /// The entity that a client attempted to create (e.g., file or directory)
491  /// already exists.
492  ///
493  /// HTTP Mapping: 409 Conflict
494  AlreadyExists = 6,
495  /// The caller does not have permission to execute the specified
496  /// operation. `PERMISSION_DENIED` must not be used for rejections
497  /// caused by exhausting some resource (use `RESOURCE_EXHAUSTED`
498  /// instead for those errors). `PERMISSION_DENIED` must not be
499  /// used if the caller can not be identified (use `UNAUTHENTICATED`
500  /// instead for those errors). This error code does not imply the
501  /// request is valid or the requested entity exists or satisfies
502  /// other pre-conditions.
503  ///
504  /// HTTP Mapping: 403 Forbidden
505  PermissionDenied = 7,
506  /// The request does not have valid authentication credentials for the
507  /// operation.
508  ///
509  /// HTTP Mapping: 401 Unauthorized
510  Unauthenticated = 16,
511  /// Some resource has been exhausted, perhaps a per-user quota, or
512  /// perhaps the entire file system is out of space.
513  ///
514  /// HTTP Mapping: 429 Too Many Requests
515  ResourceExhausted = 8,
516  /// The operation was rejected because the system is not in a state
517  /// required for the operation's execution.  For example, the directory
518  /// to be deleted is non-empty, an rmdir operation is applied to
519  /// a non-directory, etc.
520  ///
521  /// Service implementors can use the following guidelines to decide
522  /// between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`:
523  ///   (a) Use `UNAVAILABLE` if the client can retry just the failing call.
524  ///   (b) Use `ABORTED` if the client should retry at a higher level. For
525  ///       example, when a client-specified test-and-set fails, indicating the
526  ///       client should restart a read-modify-write sequence.
527  ///   (c) Use `FAILED_PRECONDITION` if the client should not retry until
528  ///       the system state has been explicitly fixed. For example, if an "rmdir"
529  ///       fails because the directory is non-empty, `FAILED_PRECONDITION`
530  ///       should be returned since the client should not retry unless
531  ///       the files are deleted from the directory.
532  ///
533  /// HTTP Mapping: 400 Bad Request
534  FailedPrecondition = 9,
535  /// The operation was aborted, typically due to a concurrency issue such as
536  /// a sequencer check failure or transaction abort.
537  ///
538  /// See the guidelines above for deciding between `FAILED_PRECONDITION`,
539  /// `ABORTED`, and `UNAVAILABLE`.
540  ///
541  /// HTTP Mapping: 409 Conflict
542  Aborted = 10,
543  /// The operation was attempted past the valid range.  E.g., seeking or
544  /// reading past end-of-file.
545  ///
546  /// Unlike `INVALID_ARGUMENT`, this error indicates a problem that may
547  /// be fixed if the system state changes. For example, a 32-bit file
548  /// system will generate `INVALID_ARGUMENT` if asked to read at an
549  /// offset that is not in the range \[0,2^32-1\], but it will generate
550  /// `OUT_OF_RANGE` if asked to read from an offset past the current
551  /// file size.
552  ///
553  /// There is a fair bit of overlap between `FAILED_PRECONDITION` and
554  /// `OUT_OF_RANGE`.  We recommend using `OUT_OF_RANGE` (the more specific
555  /// error) when it applies so that callers who are iterating through
556  /// a space can easily look for an `OUT_OF_RANGE` error to detect when
557  /// they are done.
558  ///
559  /// HTTP Mapping: 400 Bad Request
560  OutOfRange = 11,
561  /// The operation is not implemented or is not supported/enabled in this
562  /// service.
563  ///
564  /// HTTP Mapping: 501 Not Implemented
565  Unimplemented = 12,
566  /// Internal errors.  This means that some invariants expected by the
567  /// underlying system have been broken.  This error code is reserved
568  /// for serious errors.
569  ///
570  /// HTTP Mapping: 500 Internal Server Error
571  Internal = 13,
572  /// The service is currently unavailable.  This is most likely a
573  /// transient condition, which can be corrected by retrying with
574  /// a backoff. Note that it is not always safe to retry
575  /// non-idempotent operations.
576  ///
577  /// See the guidelines above for deciding between `FAILED_PRECONDITION`,
578  /// `ABORTED`, and `UNAVAILABLE`.
579  ///
580  /// HTTP Mapping: 503 Service Unavailable
581  Unavailable = 14,
582  /// Unrecoverable data loss or corruption.
583  ///
584  /// HTTP Mapping: 500 Internal Server Error
585  DataLoss = 15,
586}
587impl Code {
588  /// String value of the enum field names used in the ProtoBuf definition.
589  ///
590  /// The values are not transformed in any way and thus are considered stable
591  /// (if the ProtoBuf definition does not change) and safe for programmatic use.
592  pub fn as_str_name(&self) -> &'static str {
593    match self {
594      Self::Ok => "OK",
595      Self::Cancelled => "CANCELLED",
596      Self::Unknown => "UNKNOWN",
597      Self::InvalidArgument => "INVALID_ARGUMENT",
598      Self::DeadlineExceeded => "DEADLINE_EXCEEDED",
599      Self::NotFound => "NOT_FOUND",
600      Self::AlreadyExists => "ALREADY_EXISTS",
601      Self::PermissionDenied => "PERMISSION_DENIED",
602      Self::Unauthenticated => "UNAUTHENTICATED",
603      Self::ResourceExhausted => "RESOURCE_EXHAUSTED",
604      Self::FailedPrecondition => "FAILED_PRECONDITION",
605      Self::Aborted => "ABORTED",
606      Self::OutOfRange => "OUT_OF_RANGE",
607      Self::Unimplemented => "UNIMPLEMENTED",
608      Self::Internal => "INTERNAL",
609      Self::Unavailable => "UNAVAILABLE",
610      Self::DataLoss => "DATA_LOSS",
611    }
612  }
613  /// Creates an enum from field names used in the ProtoBuf definition.
614  pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
615    match value {
616      "OK" => Some(Self::Ok),
617      "CANCELLED" => Some(Self::Cancelled),
618      "UNKNOWN" => Some(Self::Unknown),
619      "INVALID_ARGUMENT" => Some(Self::InvalidArgument),
620      "DEADLINE_EXCEEDED" => Some(Self::DeadlineExceeded),
621      "NOT_FOUND" => Some(Self::NotFound),
622      "ALREADY_EXISTS" => Some(Self::AlreadyExists),
623      "PERMISSION_DENIED" => Some(Self::PermissionDenied),
624      "UNAUTHENTICATED" => Some(Self::Unauthenticated),
625      "RESOURCE_EXHAUSTED" => Some(Self::ResourceExhausted),
626      "FAILED_PRECONDITION" => Some(Self::FailedPrecondition),
627      "ABORTED" => Some(Self::Aborted),
628      "OUT_OF_RANGE" => Some(Self::OutOfRange),
629      "UNIMPLEMENTED" => Some(Self::Unimplemented),
630      "INTERNAL" => Some(Self::Internal),
631      "UNAVAILABLE" => Some(Self::Unavailable),
632      "DATA_LOSS" => Some(Self::DataLoss),
633      _ => None,
634    }
635  }
636}
637/// The `Status` type defines a logical error model that is suitable for
638/// different programming environments, including REST APIs and RPC APIs. It is
639/// used by [gRPC](<https://github.com/grpc>). Each `Status` message contains
640/// three pieces of data: error code, error message, and error details.
641///
642/// You can find out more about this error model and how to work with it in the
643/// [API Design Guide](<https://cloud.google.com/apis/design/errors>).
644#[derive(Clone, PartialEq, ::prost::Message)]
645#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
646pub struct Status {
647  /// The status code, which should be an enum value of
648  /// [google.rpc.Code][google.rpc.Code].
649  #[prost(int32, tag = "1")]
650  pub code: i32,
651  /// A developer-facing error message, which should be in English. Any
652  /// user-facing error message should be localized and sent in the
653  /// [google.rpc.Status.details][google.rpc.Status.details] field, or localized
654  /// by the client.
655  #[prost(string, tag = "2")]
656  pub message: ::prost::alloc::string::String,
657  /// A list of messages that carry the error details.  There is a common set of
658  /// message types for APIs to use.
659  #[prost(message, repeated, tag = "3")]
660  pub details: ::prost::alloc::vec::Vec<crate::protobuf::Any>,
661}