flow_domain/
connection.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Serialize, Deserialize)]
7pub struct ConnectionProfile {
8 pub id: String,
9 pub name: String,
10 #[serde(rename = "type")]
13 pub kind: String,
14 pub host: String,
15 pub port: u16,
16 pub user: String,
17 #[serde(default = "default_protocol")]
19 pub protocol: String,
20 #[serde(default = "default_reject_unauthorized", rename = "rejectUnauthorized")]
24 pub reject_unauthorized: bool,
25}
26
27fn default_protocol() -> String {
28 "https".into()
29}
30
31fn default_reject_unauthorized() -> bool {
32 true
33}
34
35impl ConnectionProfile {
36 pub fn new_zosmf(
37 id: impl Into<String>,
38 name: impl Into<String>,
39 host: impl Into<String>,
40 port: u16,
41 user: impl Into<String>,
42 ) -> Self {
43 Self {
44 id: id.into(),
45 name: name.into(),
46 kind: "zosmf".into(),
47 host: host.into(),
48 port,
49 user: user.into(),
50 protocol: "https".into(),
51 reject_unauthorized: true,
52 }
53 }
54}