1use std::collections::HashMap;
24
25use serde::{Deserialize, Serialize};
26
27#[derive(Deserialize, Serialize, Debug, Default)]
28pub struct Alert {
29 pub create_time: String,
30 pub event: String,
31 pub project_name: String,
32 pub service_name: String,
33 pub service_type: String,
34 pub severity: String,
35}
36
37#[derive(Deserialize, Serialize, Debug, Default)]
38pub struct ResAlerts {
39 pub alerts: Vec<Alert>,
40}
41#[derive(Deserialize, Serialize, Debug, Default)]
42pub struct ACL {
43 pub id: String,
44 pub permission: String,
45 pub topic: String,
46 pub username: String,
47}
48
49#[derive(Deserialize, Serialize, Debug, Default)]
50pub struct Backup {
51 pub backup_name: String,
52 pub backup_time: String,
53 pub data_size: i64,
54}
55
56#[derive(Deserialize, Serialize, Debug, Default)]
57pub struct Component {
58 pub component: String,
59 pub host: String,
60 pub kafka_authentication_method: Option<String>,
61 pub port: i32,
62 pub route: Option<String>,
63 pub ssl: Option<bool>,
64 pub usage: String,
65}
66
67#[derive(Deserialize, Serialize, Debug, Default)]
68pub struct ConnectionPool {
69 pub connection_uri: String,
70 pub database: String,
71 pub pool_mode: String,
72 pub pool_name: String,
73 pub pool_size: i32,
74 pub username: String,
75}
76
77#[derive(Deserialize, Serialize, Debug, Default)]
78pub struct Update {
79 pub deadline: String,
80 pub description: String,
81 pub start_after: String,
82 pub start_at: String,
83}
84
85#[derive(Deserialize, Serialize, Debug, Default)]
86pub struct Maintenance {
87 pub dow: String,
88 pub time: String,
89 pub updates: Vec<Update>,
90}
91
92#[derive(Deserialize, Serialize, Debug, Default)]
93pub struct ProgressUpdate {
94 pub completed: bool,
95 pub current: i64,
96 pub max: i64,
97 pub min: i64,
98 pub phase: String,
99 pub unit: String,
100}
101
102#[derive(Deserialize, Serialize, Debug, Default)]
103pub struct NodeState {
104 pub name: String,
105 pub progress_updates: Vec<ProgressUpdate>,
106 pub state: String,
107}
108
109#[derive(Deserialize, Serialize, Debug, Default)]
110pub struct ServiceIntegration {
111 pub active: bool,
112 pub description: String,
113 pub dest_endpoint: String,
114 pub dest_endpoint_id: String,
115 pub dest_project: String,
116 pub dest_service: String,
117 pub dest_service_type: String,
118 pub enabled: bool,
119 pub integration_status: HashMap<String, serde_json::Value>,
120 pub integration_type: String,
121 pub service_integration_id: String,
122 pub source_endpoint: String,
123 pub source_endpoint_id: String,
124 pub source_project: String,
125 pub source_service: String,
126 pub source_service_type: String,
127 pub user_config: HashMap<String, serde_json::Value>,
128}
129
130#[derive(Deserialize, Serialize, Debug, Default)]
131pub struct Topic {
132 pub cleanup_policy: String,
133 pub min_insync_replicas: i32,
134 pub partitions: i32,
135 pub replication: i32,
136 pub retention_bytes: i32,
137 pub retention_hours: i32,
138 pub state: String,
139 pub topic_name: String,
140}
141
142#[derive(Deserialize, Serialize, Debug, Default)]
143pub struct User {
144 pub access_cert: String,
145 pub access_key: String,
146 pub authentication: Option<String>,
147 pub password: String,
148 #[serde(rename = "type")]
149 pub user_type: String,
150 pub username: String,
151}
152
153#[derive(Deserialize, Serialize, Debug, Default)]
154pub struct Service {
155 pub acl: Option<Vec<ACL>>,
156 pub backups: Vec<Backup>,
157 pub cloud_description: String,
158 pub cloud_name: String,
159 pub components: Vec<Component>,
160 pub connection_info: HashMap<String, serde_json::Value>,
161 pub connection_pools: Option<Vec<ConnectionPool>>,
162 pub create_time: String,
163 pub disk_space_mb: i64,
164 pub databases: Option<Vec<String>>,
165 pub features: HashMap<String, serde_json::Value>,
166 pub group_list: Vec<String>,
167 pub maintenance: Maintenance,
168 pub metadata: HashMap<String, serde_json::Value>,
169 pub node_count: i32,
170 pub node_cpu_count: i32,
171 pub node_memory_mb: i32,
172 pub node_states: Vec<NodeState>,
173 pub plan: String,
174 pub project_vpc_id: Option<String>,
175 pub service_integrations: Vec<ServiceIntegration>,
176 pub service_name: String,
177 pub service_type: String,
178 pub service_type_description: String,
179 pub service_uri: String,
180 pub service_uri_params: HashMap<String, serde_json::Value>,
181 pub state: String,
182 pub termination_protection: bool,
183 pub topics: Option<Vec<Topic>>,
184 pub update_time: String,
185 pub user_config: HashMap<String, serde_json::Value>,
186 pub users: Vec<User>,
187}
188#[derive(Deserialize, Serialize, Debug, Default)]
189pub struct ResService {
190 pub service: Service,
191}
192
193#[derive(Deserialize, Serialize, Debug, Default)]
194pub struct ServiceCancelQuery {
195 pub success: bool,
196}
197
198#[derive(Deserialize, Serialize, Debug, Default)]
199pub struct ServiceUser {
200 pub access_cert: String,
201 pub access_key: String,
202 pub authentication: String,
203 pub password: String,
204 #[serde(rename = "type")]
205 pub account_type: String,
206 pub username: String,
207}
208
209#[derive(Deserialize, Serialize, Debug, Default)]
210pub struct ResServiceUser {
211 pub user: ServiceUser,
212}
213
214#[derive(Deserialize, Serialize, Debug, Default)]
215pub struct ResResetQueryStats {
216 pub queries: Vec<serde_json::Value>,
217}
218#[derive(Deserialize, Serialize, Debug, Default)]
219pub struct BackupConfig {
220 pub interval: i32,
221 pub max_count: i32,
222 pub recovery_mode: String,
223}
224
225#[derive(Deserialize, Serialize, Debug, Default)]
226pub struct Region {
227 pub disk_space_mb: i32,
228 pub node_cpu_count: i32,
229 pub node_memory_mb: i32,
230 pub price_usd: String,
231}
232
233#[derive(Deserialize, Serialize, Debug, Default)]
234pub struct ServicePlan {
235 pub backup_config: BackupConfig,
236 pub node_count: i64,
237 pub regions: HashMap<String, Region>,
238}
239
240#[derive(Deserialize, Serialize, Debug, Default)]
241pub struct ResServices {
242 pub services: Vec<Service>,
243}
244#[derive(Deserialize, Serialize, Debug, Default)]
245pub struct ServiceDescription {
246 pub description: String,
247 pub service_plans: Vec<ServicePlan>,
248 pub latest_available_version: Option<String>,
249 pub user_config_schema: Option<serde_json::Value>,
250}
251
252#[derive(Deserialize, Serialize, Debug, Default)]
253pub struct UserConfigSchema {
254 #[serde(rename = "additionalProperties")]
255 pub additional_properties: bool,
256}
257
258#[derive(Deserialize, Serialize, Debug, Default)]
259pub struct ResServiceTypes {
260 pub service_types: HashMap<String, ServiceDescription>,
261}
262#[derive(Deserialize, Serialize, Debug, Default)]
263pub struct DatabaseName {
264 pub database_name: String,
265}
266#[derive(Deserialize, Serialize, Debug, Default)]
267pub struct ResDatabaseNames {
268 pub databases: Vec<DatabaseName>,
269}
270
271#[derive(Deserialize, Serialize, Debug, Default)]
272pub struct Database {
273 pub database_name: String,
274 pub lc_collate: String,
275 pub lc_ctype: String,
276 pub owner: String,
277 pub quoted_owner: String,
278}
279#[derive(Deserialize, Serialize, Debug, Default)]
280pub struct ResServiceDatabaseList {
281 pub databases: Vec<Database>,
282}
283
284#[derive(Deserialize, Serialize, Debug, Default)]
285pub struct ResEnableWrites {
286 pub until: String,
287}
288#[derive(Deserialize, Serialize, Debug, Default)]
289pub struct ResServiceCA {
290 pub certificate: String,
292}
293
294#[derive(Deserialize, Serialize, Debug, Default)]
295pub struct ResServiceKeyPair {
296 pub certificate: String,
298 pub key: String,
299}
300
301#[derive(Deserialize, Serialize, Debug, Default)]
302pub struct Task {
303 pub create_time: String,
304 pub result: String,
305 pub success: bool,
306 pub task_type: String,
307}
308
309#[derive(Deserialize, Serialize, Debug, Default)]
310pub struct ResTask {
311 pub task: Task,
312}
313
314#[derive(Deserialize, Serialize, Debug, Default)]
315pub struct Log {
316 pub msg: String,
317 pub time: String,
318 pub unit: String,
319}
320#[derive(Deserialize, Serialize, Debug, Default)]
321pub struct ResLogs {
322 pub first_log_offset: String,
323 pub logs: Vec<Log>,
324 pub offset: String,
325}
326
327#[derive(Deserialize, Serialize, Debug, Default)]
328pub struct ResQueries {
329 pub queries: Vec<Query>,
330}
331#[derive(Deserialize, Serialize, Debug, Default)]
332pub struct Query {
333 pub active_channel_subscriptions: i32,
334 pub active_database: String,
335 pub active_pattern_matching_channel_subscriptions: i32,
336 pub application_name: String,
337 pub backend_start: String,
338 pub backend_type: String,
339 pub backend_xid: String,
340 pub backend_xmin: String,
341 pub client_addr: String,
342 pub client_hostname: String,
343 pub client_port: i32,
344 pub connection_age_seconds: i32,
345 pub connection_idle_seconds: i32,
346 pub datid: i32,
347 pub datname: String,
348 pub flags: Vec<String>,
349 pub flags_raw: String,
350 pub id: String,
351 pub multi_exec_commands: i32,
352 pub name: String,
353 pub output_buffer: i32,
354 pub output_buffer_memory: i32,
355 pub output_list_length: i32,
356 pub pid: i32,
357 pub query: String,
358 pub query_buffer: i32,
359 pub query_buffer_free: i32,
360 pub query_duration: f32,
361 pub query_start: String,
362 pub state: String,
363 pub state_change: String,
364 pub usename: String,
365 pub usesysid: i32,
366 pub wait_event: String,
367 pub wait_event_type: String,
368 pub waiting: bool,
369 pub xact_start: String,
370}