1use serde::Deserialize;
2
3#[derive(Deserialize, Debug)]
4pub struct Path{
5 pub ws_base: Option<String>,
6 pub rest_base: Option<String>,
7 pub keys_service: Option<String>,
8 pub messages_bus: Option<String>,
9}
10
11impl Path{
12 pub fn get_streaming_base(&self) -> Option<String>{
13 self.ws_base.clone()
14 }
15 pub fn get_rest_base(&self) -> Option<String>{
16 self.rest_base.clone()
17 }
18 pub fn get_keys_service(&self) -> Option<String>{
19 match &self.keys_service{
20 None => {
21 match self.rest_base.clone(){
22 None => { None }
23 Some(rest_base) => {
24 Some(format!("{}/keys", rest_base).to_string())
25 }
26 }
27 }
28 Some(s) => {
29 Some(s.clone())
30 }
31 }
32 }
33 pub fn get_messages_bus(&self) -> Option<String>{
34 match &self.messages_bus{
35 None => {
36 match self.ws_base.clone(){
37 None => { None }
38 Some(ws_base) => {
39 Some(format!("{}/rotor", ws_base).to_string())
40 }
41 }
42 }
43 Some(s) => {
44 Some(s.clone())
45 }
46 }
47 }
48}