cat_gateway/service/common/responses/
code_503_service_unavailable.rs1use poem_openapi::{types::Example, Object};
4use uuid::Uuid;
5
6use crate::service::common;
7
8#[derive(Object)]
9#[oai(example)]
10pub(crate) struct ServiceUnavailable {
15 id: common::types::generic::error_uuid::ErrorUuid,
17 msg: common::types::generic::error_msg::ErrorMessage,
20}
21
22impl ServiceUnavailable {
23 pub(crate) fn new(msg: Option<String>) -> Self {
25 let msg = msg.unwrap_or(
26 "Service Unavailable. Indicates that the server is not ready to handle the request."
27 .to_string(),
28 );
29 let id = Uuid::new_v4();
30
31 Self {
32 id: id.into(),
33 msg: msg.into(),
34 }
35 }
36
37 pub(crate) fn id(&self) -> Uuid {
39 self.id.clone().into()
40 }
41}
42
43impl Example for ServiceUnavailable {
44 fn example() -> Self {
46 Self::new(None)
47 }
48}