aboutsummaryrefslogtreecommitdiff
path: root/src/utils/data.rs
diff options
context:
space:
mode:
authornotgne22020-09-28 14:37:43 -0700
committernotgne22020-09-28 14:37:43 -0700
commitf73e393a75fcad939a240ff3b72cbc75813e90e3 (patch)
tree39304318db967f39ed6925f5206174dd5b14dbab /src/utils/data.rs
parent73b99043a71f27f98bf11510fb8db46fa086383c (diff)
Add missing files
Diffstat (limited to '')
-rw-r--r--src/utils/data.rs64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/utils/data.rs b/src/utils/data.rs
new file mode 100644
index 0000000..779d913
--- /dev/null
+++ b/src/utils/data.rs
@@ -0,0 +1,64 @@
+use merge::Merge;
+
+use std::{collections::HashMap};
+
+#[derive(Deserialize, Debug, Clone, Merge)]
+pub struct GenericSettings {
+ #[serde(rename(deserialize = "sshUser"))]
+ pub ssh_user: Option<String>,
+ pub user: Option<String>,
+ #[serde(
+ skip_serializing_if = "Vec::is_empty",
+ default,
+ rename(deserialize = "sshOpts")
+ )]
+ #[merge(strategy = merge::vec::append)]
+ pub ssh_opts: Vec<String>,
+ #[serde(rename(deserialize = "fastConnection"))]
+ pub fast_connection: Option<bool>,
+ #[serde(rename(deserialize = "autoRollback"))]
+ pub auto_rollback: Option<String>,
+}
+
+#[derive(Deserialize, Debug, Clone)]
+pub struct NodeSettings {
+ pub hostname: String,
+}
+
+#[derive(Deserialize, Debug, Clone)]
+pub struct ProfileSettings {
+ pub path: String,
+ pub activate: Option<String>,
+ pub bootstrap: Option<String>,
+}
+
+#[derive(Deserialize, Debug, Clone)]
+pub struct Profile {
+ #[serde(flatten)]
+ pub profile_settings: ProfileSettings,
+ #[serde(flatten)]
+ pub generic_settings: GenericSettings,
+}
+
+#[derive(Deserialize, Debug, Clone)]
+pub struct Node {
+ #[serde(flatten)]
+ pub generic_settings: GenericSettings,
+ #[serde(flatten)]
+ pub node_settings: NodeSettings,
+
+ pub profiles: HashMap<String, Profile>,
+ #[serde(
+ skip_serializing_if = "Vec::is_empty",
+ default,
+ rename(deserialize = "profilesOrder")
+ )]
+ pub profiles_order: Vec<String>,
+}
+
+#[derive(Deserialize, Debug, Clone)]
+pub struct Data {
+ #[serde(flatten)]
+ pub generic_settings: GenericSettings,
+ pub nodes: HashMap<String, Node>,
+}