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