uqa_client/
http_limit_kind.rs1use serde::{Deserialize, Serialize};
8
9#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
11#[serde(rename_all = "snake_case")]
12pub enum HttpLimitKind {
13 RequestBodyBytes,
14 #[serde(rename = "sql_bytes")]
15 SQLBytes,
16 Parameters,
17 BatchStatements,
18 ResultBytes,
19 QueryAdmission,
20 AuthenticationAdmission,
21}
22
23impl HttpLimitKind {
24 pub const fn as_str(self) -> &'static str {
25 match self {
26 Self::RequestBodyBytes => "request_body_bytes",
27 Self::SQLBytes => "sql_bytes",
28 Self::Parameters => "parameters",
29 Self::BatchStatements => "batch_statements",
30 Self::ResultBytes => "result_bytes",
31 Self::QueryAdmission => "query_admission",
32 Self::AuthenticationAdmission => "authentication_admission",
33 }
34 }
35
36 pub(crate) const fn code(self) -> &'static str {
37 match self {
38 Self::RequestBodyBytes => "REQUEST_BODY_TOO_LARGE",
39 Self::SQLBytes => "SQL_TOO_LARGE",
40 Self::Parameters => "TOO_MANY_PARAMETERS",
41 Self::BatchStatements => "TOO_MANY_STATEMENTS",
42 Self::ResultBytes => "RESULT_TOO_LARGE",
43 Self::QueryAdmission | Self::AuthenticationAdmission => "NODE_BUSY",
44 }
45 }
46
47 pub(crate) const fn is_admission(self) -> bool {
48 matches!(self, Self::QueryAdmission | Self::AuthenticationAdmission)
49 }
50}