Skip to main content

momento_protos/protosocket/
common.rs

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct CommandError {
4    #[prost(enumeration = "Status", tag = "1")]
5    pub code: i32,
6    #[prost(string, tag = "2")]
7    pub message: ::prost::alloc::string::String,
8}
9#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
10#[repr(i32)]
11pub enum Status {
12    Ok = 0,
13    Cancelled = 1,
14    Unknown = 2,
15    InvalidArgument = 3,
16    DeadlineExceeded = 4,
17    NotFound = 5,
18    AlreadyExists = 6,
19    PermissionDenied = 7,
20    ResourceExhausted = 8,
21    FailedPrecondition = 9,
22    Aborted = 10,
23    OutOfRange = 11,
24    Unimplemented = 12,
25    Internal = 13,
26    Unavailable = 14,
27    DataLoss = 15,
28    Unauthenticated = 16,
29}
30impl Status {
31    /// String value of the enum field names used in the ProtoBuf definition.
32    ///
33    /// The values are not transformed in any way and thus are considered stable
34    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
35    pub fn as_str_name(&self) -> &'static str {
36        match self {
37            Self::Ok => "OK",
38            Self::Cancelled => "CANCELLED",
39            Self::Unknown => "UNKNOWN",
40            Self::InvalidArgument => "INVALID_ARGUMENT",
41            Self::DeadlineExceeded => "DEADLINE_EXCEEDED",
42            Self::NotFound => "NOT_FOUND",
43            Self::AlreadyExists => "ALREADY_EXISTS",
44            Self::PermissionDenied => "PERMISSION_DENIED",
45            Self::ResourceExhausted => "RESOURCE_EXHAUSTED",
46            Self::FailedPrecondition => "FAILED_PRECONDITION",
47            Self::Aborted => "ABORTED",
48            Self::OutOfRange => "OUT_OF_RANGE",
49            Self::Unimplemented => "UNIMPLEMENTED",
50            Self::Internal => "INTERNAL",
51            Self::Unavailable => "UNAVAILABLE",
52            Self::DataLoss => "DATA_LOSS",
53            Self::Unauthenticated => "UNAUTHENTICATED",
54        }
55    }
56    /// Creates an enum from field names used in the ProtoBuf definition.
57    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
58        match value {
59            "OK" => Some(Self::Ok),
60            "CANCELLED" => Some(Self::Cancelled),
61            "UNKNOWN" => Some(Self::Unknown),
62            "INVALID_ARGUMENT" => Some(Self::InvalidArgument),
63            "DEADLINE_EXCEEDED" => Some(Self::DeadlineExceeded),
64            "NOT_FOUND" => Some(Self::NotFound),
65            "ALREADY_EXISTS" => Some(Self::AlreadyExists),
66            "PERMISSION_DENIED" => Some(Self::PermissionDenied),
67            "RESOURCE_EXHAUSTED" => Some(Self::ResourceExhausted),
68            "FAILED_PRECONDITION" => Some(Self::FailedPrecondition),
69            "ABORTED" => Some(Self::Aborted),
70            "OUT_OF_RANGE" => Some(Self::OutOfRange),
71            "UNIMPLEMENTED" => Some(Self::Unimplemented),
72            "INTERNAL" => Some(Self::Internal),
73            "UNAVAILABLE" => Some(Self::Unavailable),
74            "DATA_LOSS" => Some(Self::DataLoss),
75            "UNAUTHENTICATED" => Some(Self::Unauthenticated),
76            _ => None,
77        }
78    }
79}