1
#pragma once
2

            
3
#include <cstdint>
4

            
5
namespace Envoy {
6
namespace Grpc {
7

            
8
class Status {
9
public:
10
  using GrpcStatus = int64_t;
11

            
12
  enum WellKnownGrpcStatus {
13
    // The RPC completed successfully.
14
    Ok = 0,
15
    // The RPC was canceled.
16
    Canceled = 1,
17
    // Some unknown error occurred.
18
    Unknown = 2,
19
    // An argument to the RPC was invalid.
20
    InvalidArgument = 3,
21
    // The deadline for the RPC expired before the RPC completed.
22
    DeadlineExceeded = 4,
23
    // Some resource for the RPC was not found.
24
    NotFound = 5,
25
    // A resource the RPC attempted to create already exists.
26
    AlreadyExists = 6,
27
    // Permission was denied for the RPC.
28
    PermissionDenied = 7,
29
    // Some resource is exhausted, resulting in RPC failure.
30
    ResourceExhausted = 8,
31
    // Some precondition for the RPC failed.
32
    FailedPrecondition = 9,
33
    // The RPC was aborted.
34
    Aborted = 10,
35
    // Some operation was requested outside of a legal range.
36
    OutOfRange = 11,
37
    // The RPC requested was not implemented.
38
    Unimplemented = 12,
39
    // Some internal error occurred.
40
    Internal = 13,
41
    // The RPC endpoint is current unavailable.
42
    Unavailable = 14,
43
    // There was some data loss resulting in RPC failure.
44
    DataLoss = 15,
45
    // The RPC does not have required credentials for the RPC to succeed.
46
    Unauthenticated = 16,
47

            
48
    // Maximum value of valid status codes.
49
    MaximumKnown = Unauthenticated,
50

            
51
    // This is a non-GRPC error code, indicating the status code in gRPC headers
52
    // was invalid.
53
    InvalidCode = -1,
54
  };
55
};
56

            
57
} // namespace Grpc
58
} // namespace Envoy