envoy_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
12    /// \[google.rpc.Code\]\[google.rpc.Code\].
13    #[prost(int32, tag = "1")]
14    pub code: i32,
15    /// A developer-facing error message, which should be in English. Any
16    /// user-facing error message should be localized and sent in the
17    /// \[google.rpc.Status.details\]\[google.rpc.Status.details\] field, or localized
18    /// by the client.
19    #[prost(string, tag = "2")]
20    pub message: ::prost::alloc::string::String,
21    /// A list of messages that carry the error details.  There is a common set of
22    /// message types for APIs to use.
23    #[prost(message, repeated, tag = "3")]
24    pub details: ::prost::alloc::vec::Vec<super::protobuf::Any>,
25}
26impl ::prost::Name for Status {
27    const NAME: &'static str = "Status";
28    const PACKAGE: &'static str = "google.rpc";
29    fn full_name() -> ::prost::alloc::string::String {
30        "google.rpc.Status".into()
31    }
32    fn type_url() -> ::prost::alloc::string::String {
33        "type.googleapis.com/google.rpc.Status".into()
34    }
35}
36/// The canonical error codes for gRPC APIs.
37///
38/// Sometimes multiple error codes may apply.  Services should return
39/// the most specific error code that applies.  For example, prefer
40/// `OUT_OF_RANGE` over `FAILED_PRECONDITION` if both codes apply.
41/// Similarly prefer `NOT_FOUND` or `ALREADY_EXISTS` over `FAILED_PRECONDITION`.
42#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
43#[repr(i32)]
44pub enum Code {
45    /// Not an error; returned on success.
46    ///
47    /// HTTP Mapping: 200 OK
48    Ok = 0,
49    /// The operation was cancelled, typically by the caller.
50    ///
51    /// HTTP Mapping: 499 Client Closed Request
52    Cancelled = 1,
53    /// Unknown error.  For example, this error may be returned when
54    /// a `Status` value received from another address space belongs to
55    /// an error space that is not known in this address space.  Also
56    /// errors raised by APIs that do not return enough error information
57    /// may be converted to this error.
58    ///
59    /// HTTP Mapping: 500 Internal Server Error
60    Unknown = 2,
61    /// The client specified an invalid argument.  Note that this differs
62    /// from `FAILED_PRECONDITION`.  `INVALID_ARGUMENT` indicates arguments
63    /// that are problematic regardless of the state of the system
64    /// (e.g., a malformed file name).
65    ///
66    /// HTTP Mapping: 400 Bad Request
67    InvalidArgument = 3,
68    /// The deadline expired before the operation could complete. For operations
69    /// that change the state of the system, this error may be returned
70    /// even if the operation has completed successfully.  For example, a
71    /// successful response from a server could have been delayed long
72    /// enough for the deadline to expire.
73    ///
74    /// HTTP Mapping: 504 Gateway Timeout
75    DeadlineExceeded = 4,
76    /// Some requested entity (e.g., file or directory) was not found.
77    ///
78    /// Note to server developers: if a request is denied for an entire class
79    /// of users, such as gradual feature rollout or undocumented allowlist,
80    /// `NOT_FOUND` may be used. If a request is denied for some users within
81    /// a class of users, such as user-based access control, `PERMISSION_DENIED`
82    /// must be used.
83    ///
84    /// HTTP Mapping: 404 Not Found
85    NotFound = 5,
86    /// The entity that a client attempted to create (e.g., file or directory)
87    /// already exists.
88    ///
89    /// HTTP Mapping: 409 Conflict
90    AlreadyExists = 6,
91    /// The caller does not have permission to execute the specified
92    /// operation. `PERMISSION_DENIED` must not be used for rejections
93    /// caused by exhausting some resource (use `RESOURCE_EXHAUSTED`
94    /// instead for those errors). `PERMISSION_DENIED` must not be
95    /// used if the caller can not be identified (use `UNAUTHENTICATED`
96    /// instead for those errors). This error code does not imply the
97    /// request is valid or the requested entity exists or satisfies
98    /// other pre-conditions.
99    ///
100    /// HTTP Mapping: 403 Forbidden
101    PermissionDenied = 7,
102    /// The request does not have valid authentication credentials for the
103    /// operation.
104    ///
105    /// HTTP Mapping: 401 Unauthorized
106    Unauthenticated = 16,
107    /// Some resource has been exhausted, perhaps a per-user quota, or
108    /// perhaps the entire file system is out of space.
109    ///
110    /// HTTP Mapping: 429 Too Many Requests
111    ResourceExhausted = 8,
112    /// The operation was rejected because the system is not in a state
113    /// required for the operation's execution.  For example, the directory
114    /// to be deleted is non-empty, an rmdir operation is applied to
115    /// a non-directory, etc.
116    ///
117    /// Service implementors can use the following guidelines to decide
118    /// between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`:
119    /// (a) Use `UNAVAILABLE` if the client can retry just the failing call.
120    /// (b) Use `ABORTED` if the client should retry at a higher level. For
121    /// example, when a client-specified test-and-set fails, indicating the
122    /// client should restart a read-modify-write sequence.
123    /// (c) Use `FAILED_PRECONDITION` if the client should not retry until
124    /// the system state has been explicitly fixed. For example, if an "rmdir"
125    /// fails because the directory is non-empty, `FAILED_PRECONDITION`
126    /// should be returned since the client should not retry unless
127    /// the files are deleted from the directory.
128    ///
129    /// HTTP Mapping: 400 Bad Request
130    FailedPrecondition = 9,
131    /// The operation was aborted, typically due to a concurrency issue such as
132    /// a sequencer check failure or transaction abort.
133    ///
134    /// See the guidelines above for deciding between `FAILED_PRECONDITION`,
135    /// `ABORTED`, and `UNAVAILABLE`.
136    ///
137    /// HTTP Mapping: 409 Conflict
138    Aborted = 10,
139    /// The operation was attempted past the valid range.  E.g., seeking or
140    /// reading past end-of-file.
141    ///
142    /// Unlike `INVALID_ARGUMENT`, this error indicates a problem that may
143    /// be fixed if the system state changes. For example, a 32-bit file
144    /// system will generate `INVALID_ARGUMENT` if asked to read at an
145    /// offset that is not in the range \[0,2^32-1\], but it will generate
146    /// `OUT_OF_RANGE` if asked to read from an offset past the current
147    /// file size.
148    ///
149    /// There is a fair bit of overlap between `FAILED_PRECONDITION` and
150    /// `OUT_OF_RANGE`.  We recommend using `OUT_OF_RANGE` (the more specific
151    /// error) when it applies so that callers who are iterating through
152    /// a space can easily look for an `OUT_OF_RANGE` error to detect when
153    /// they are done.
154    ///
155    /// HTTP Mapping: 400 Bad Request
156    OutOfRange = 11,
157    /// The operation is not implemented or is not supported/enabled in this
158    /// service.
159    ///
160    /// HTTP Mapping: 501 Not Implemented
161    Unimplemented = 12,
162    /// Internal errors.  This means that some invariants expected by the
163    /// underlying system have been broken.  This error code is reserved
164    /// for serious errors.
165    ///
166    /// HTTP Mapping: 500 Internal Server Error
167    Internal = 13,
168    /// The service is currently unavailable.  This is most likely a
169    /// transient condition, which can be corrected by retrying with
170    /// a backoff. Note that it is not always safe to retry
171    /// non-idempotent operations.
172    ///
173    /// See the guidelines above for deciding between `FAILED_PRECONDITION`,
174    /// `ABORTED`, and `UNAVAILABLE`.
175    ///
176    /// HTTP Mapping: 503 Service Unavailable
177    Unavailable = 14,
178    /// Unrecoverable data loss or corruption.
179    ///
180    /// HTTP Mapping: 500 Internal Server Error
181    DataLoss = 15,
182}
183impl Code {
184    /// String value of the enum field names used in the ProtoBuf definition.
185    ///
186    /// The values are not transformed in any way and thus are considered stable
187    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
188    pub fn as_str_name(&self) -> &'static str {
189        match self {
190            Self::Ok => "OK",
191            Self::Cancelled => "CANCELLED",
192            Self::Unknown => "UNKNOWN",
193            Self::InvalidArgument => "INVALID_ARGUMENT",
194            Self::DeadlineExceeded => "DEADLINE_EXCEEDED",
195            Self::NotFound => "NOT_FOUND",
196            Self::AlreadyExists => "ALREADY_EXISTS",
197            Self::PermissionDenied => "PERMISSION_DENIED",
198            Self::Unauthenticated => "UNAUTHENTICATED",
199            Self::ResourceExhausted => "RESOURCE_EXHAUSTED",
200            Self::FailedPrecondition => "FAILED_PRECONDITION",
201            Self::Aborted => "ABORTED",
202            Self::OutOfRange => "OUT_OF_RANGE",
203            Self::Unimplemented => "UNIMPLEMENTED",
204            Self::Internal => "INTERNAL",
205            Self::Unavailable => "UNAVAILABLE",
206            Self::DataLoss => "DATA_LOSS",
207        }
208    }
209    /// Creates an enum from field names used in the ProtoBuf definition.
210    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
211        match value {
212            "OK" => Some(Self::Ok),
213            "CANCELLED" => Some(Self::Cancelled),
214            "UNKNOWN" => Some(Self::Unknown),
215            "INVALID_ARGUMENT" => Some(Self::InvalidArgument),
216            "DEADLINE_EXCEEDED" => Some(Self::DeadlineExceeded),
217            "NOT_FOUND" => Some(Self::NotFound),
218            "ALREADY_EXISTS" => Some(Self::AlreadyExists),
219            "PERMISSION_DENIED" => Some(Self::PermissionDenied),
220            "UNAUTHENTICATED" => Some(Self::Unauthenticated),
221            "RESOURCE_EXHAUSTED" => Some(Self::ResourceExhausted),
222            "FAILED_PRECONDITION" => Some(Self::FailedPrecondition),
223            "ABORTED" => Some(Self::Aborted),
224            "OUT_OF_RANGE" => Some(Self::OutOfRange),
225            "UNIMPLEMENTED" => Some(Self::Unimplemented),
226            "INTERNAL" => Some(Self::Internal),
227            "UNAVAILABLE" => Some(Self::Unavailable),
228            "DATA_LOSS" => Some(Self::DataLoss),
229            _ => None,
230        }
231    }
232}