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