1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
// Code generated by @uarp/codegen from spec/openapi.json. DO NOT EDIT.
//!
//! Health checks, readiness, and metrics
#![allow(unused_imports, clippy::too_many_arguments)]
use reqwest::Method;
use serde::{Deserialize, Serialize};
use crate::client::{Client, Request, NO_BODY, NO_QUERY};
use crate::error::Result;
use crate::generated::models;
use crate::multipart::{field_text, FilePart};
use crate::sse::EventStream;
use crate::util::encode_path;
/// Health checks, readiness, and metrics
#[derive(Debug, Clone)]
pub struct HealthApi {
pub(crate) client: Client,
}
impl Client {
/// Health checks, readiness, and metrics
pub fn health(&self) -> HealthApi {
HealthApi { client: self.clone() }
}
}
impl HealthApi {
/// Health check
///
/// `GET /health`
pub async fn get(&self) -> Result<models::GetHealthResponse> {
self.client
.request_json(Request {
method: Method::GET,
path: "/health".to_string(),
query: NO_QUERY,
body: NO_BODY,
headers: Vec::new(),
idempotent: false,
})
.await
}
/// Prometheus-compatible metrics export
///
/// `GET /metrics`
pub async fn get_metrics(&self) -> Result<String> {
self.client
.request_text(Request {
method: Method::GET,
path: "/metrics".to_string(),
query: NO_QUERY,
body: NO_BODY,
headers: Vec::new(),
idempotent: false,
})
.await
}
/// Readiness probe (checks KV connectivity)
///
/// `GET /ready`
pub async fn get_ready(&self) -> Result<models::GetReadyResponse> {
self.client
.request_json(Request {
method: Method::GET,
path: "/ready".to_string(),
query: NO_QUERY,
body: NO_BODY,
headers: Vec::new(),
idempotent: false,
})
.await
}
/// Kubernetes liveness probe
///
/// `GET /health/live`
pub async fn health_live(&self) -> Result<models::HealthLiveResponse> {
self.client
.request_json(Request {
method: Method::GET,
path: "/health/live".to_string(),
query: NO_QUERY,
body: NO_BODY,
headers: Vec::new(),
idempotent: false,
})
.await
}
/// Kubernetes readiness probe
///
/// `GET /health/ready`
pub async fn health_ready(&self) -> Result<serde_json::Map<String, serde_json::Value>> {
self.client
.request_json(Request {
method: Method::GET,
path: "/health/ready".to_string(),
query: NO_QUERY,
body: NO_BODY,
headers: Vec::new(),
idempotent: false,
})
.await
}
/// SSE end-to-end health check
///
/// `GET /health/sse`
///
/// Returns a server-sent event stream.
pub fn health_sse(&self) -> EventStream {
self.client.request_stream(
"/health/sse",
NO_QUERY,
Vec::new(),
)
}
/// Health check alias (/healthz)
///
/// `GET /healthz`
pub async fn healthz_alias(&self) -> Result<models::HealthzAliasResponse> {
self.client
.request_json(Request {
method: Method::GET,
path: "/healthz".to_string(),
query: NO_QUERY,
body: NO_BODY,
headers: Vec::new(),
idempotent: false,
})
.await
}
/// Readiness alias (/readyz)
///
/// `GET /readyz`
pub async fn readyz_alias(&self) -> Result<serde_json::Map<String, serde_json::Value>> {
self.client
.request_json(Request {
method: Method::GET,
path: "/readyz".to_string(),
query: NO_QUERY,
body: NO_BODY,
headers: Vec::new(),
idempotent: false,
})
.await
}
}