chore: fix liveness and change if auth.role is empty
This commit is contained in:
		
							parent
							
								
									57378e546b
								
							
						
					
					
						commit
						7c132d9839
					
				
							
								
								
									
										29
									
								
								src/defs.rs
									
									
									
									
									
								
							
							
						
						
									
										29
									
								
								src/defs.rs
									
									
									
									
									
								
							@ -2,7 +2,7 @@ use serde::{Serialize, Deserialize, Deserializer};
 | 
			
		||||
use std::fmt;
 | 
			
		||||
 | 
			
		||||
use crate::clouds::on_clouds::load_config_data;
 | 
			
		||||
use crate::clouds::defs::Cloud;
 | 
			
		||||
use crate::clouds::defs::{Cloud,SrvcsHostInfo};
 | 
			
		||||
 | 
			
		||||
#[allow(non_snake_case)]
 | 
			
		||||
#[derive(Clone, Debug, Serialize,  Deserialize, Default)]
 | 
			
		||||
@ -534,6 +534,10 @@ impl Default for Price {
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
fn default_liveness() -> Vec<SrvcsHostInfo> {
 | 
			
		||||
	Vec::new()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[allow(non_snake_case)]
 | 
			
		||||
#[derive(Clone, Debug, Serialize,  Deserialize)]
 | 
			
		||||
pub struct CloudItem {
 | 
			
		||||
@ -541,7 +545,8 @@ pub struct CloudItem {
 | 
			
		||||
	 pub path: String,
 | 
			
		||||
	 pub info: String,
 | 
			
		||||
	 pub resources: Option<String>,
 | 
			
		||||
	 pub liveness: Option<String>,
 | 
			
		||||
	 #[serde(default = "default_liveness")]
 | 
			
		||||
	 pub liveness: Vec<SrvcsHostInfo>,
 | 
			
		||||
	 pub provision: Option<String>,
 | 
			
		||||
	 pub critical: IsCritical,
 | 
			
		||||
	 pub graph: GraphNode,
 | 
			
		||||
@ -553,7 +558,7 @@ impl Default for CloudItem {
 | 
			
		||||
      path: String::from(""),
 | 
			
		||||
      info: String::from(""),
 | 
			
		||||
			resources: Some(String::from("")),
 | 
			
		||||
			liveness: Some(String::from("")),
 | 
			
		||||
			liveness: Vec::new(),
 | 
			
		||||
			provision: Some(String::from("")),
 | 
			
		||||
			critical: IsCritical::no,
 | 
			
		||||
			graph: GraphNode::default(),
 | 
			
		||||
@ -585,6 +590,7 @@ impl CloudItem {
 | 
			
		||||
		}
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[allow(non_snake_case)]
 | 
			
		||||
#[derive(Clone, Debug, Serialize,  Deserialize)]
 | 
			
		||||
pub struct CloudGroup {
 | 
			
		||||
@ -592,7 +598,8 @@ pub struct CloudGroup {
 | 
			
		||||
	 pub path: String,
 | 
			
		||||
	 pub info: String,
 | 
			
		||||
	 pub resources: Option<String>,
 | 
			
		||||
	 pub liveness: Option<String>,
 | 
			
		||||
	 #[serde(default = "default_liveness")]
 | 
			
		||||
	 pub liveness: Vec<SrvcsHostInfo>,
 | 
			
		||||
	 pub provision: Option<String>,
 | 
			
		||||
	 pub items: Vec<CloudItem>,
 | 
			
		||||
	 pub graph: GraphNode,
 | 
			
		||||
@ -605,7 +612,7 @@ impl Default for CloudGroup {
 | 
			
		||||
      path: String::from(""),
 | 
			
		||||
      info: String::from(""),
 | 
			
		||||
			resources: Some(String::from("")),
 | 
			
		||||
			liveness: Some(String::from("")),
 | 
			
		||||
			liveness: Vec::new(),
 | 
			
		||||
			provision: Some(String::from("")),
 | 
			
		||||
			items: Vec::new(),
 | 
			
		||||
			graph: GraphNode::default(),
 | 
			
		||||
@ -632,7 +639,7 @@ impl CloudGroup {
 | 
			
		||||
			info: self.info.to_owned(),
 | 
			
		||||
			resources: Some(self.load_resources(cloud).await.unwrap_or_else(|_|String::from(""))),
 | 
			
		||||
			liveness: self.liveness.to_owned(),
 | 
			
		||||
			provision: self.liveness.to_owned(),
 | 
			
		||||
			provision: self.provision.to_owned(),
 | 
			
		||||
			items: self.items.to_owned(),
 | 
			
		||||
			graph: self.graph.to_owned(),
 | 
			
		||||
			prices: self.prices.to_owned(),
 | 
			
		||||
@ -675,7 +682,8 @@ pub struct CloudCheckItem {
 | 
			
		||||
	 pub name: String,
 | 
			
		||||
	 pub path: String,
 | 
			
		||||
	 pub info: String,
 | 
			
		||||
	 pub liveness: Option<String>,
 | 
			
		||||
	 #[serde(default = "default_liveness")]
 | 
			
		||||
	 pub liveness: Vec<SrvcsHostInfo>,
 | 
			
		||||
	 pub critical: IsCritical,
 | 
			
		||||
}
 | 
			
		||||
impl Default for CloudCheckItem {
 | 
			
		||||
@ -684,7 +692,7 @@ impl Default for CloudCheckItem {
 | 
			
		||||
      name: String::from(""),
 | 
			
		||||
      path: String::from(""),
 | 
			
		||||
      info: String::from(""),
 | 
			
		||||
			liveness: Some(String::from("")),
 | 
			
		||||
			liveness: Vec::new(),
 | 
			
		||||
			critical: IsCritical::no,
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
@ -695,7 +703,8 @@ pub struct CloudCheckGroup {
 | 
			
		||||
	 pub name: String,
 | 
			
		||||
	 pub path: String,
 | 
			
		||||
	 pub info: String,
 | 
			
		||||
	 pub liveness: Option<String>,
 | 
			
		||||
	 #[serde(default = "default_liveness")]
 | 
			
		||||
	 pub liveness: Vec<SrvcsHostInfo>,
 | 
			
		||||
	 pub items: Vec<CloudCheckItem>,
 | 
			
		||||
}
 | 
			
		||||
impl Default for CloudCheckGroup {
 | 
			
		||||
@ -704,7 +713,7 @@ impl Default for CloudCheckGroup {
 | 
			
		||||
      name: String::from(""),
 | 
			
		||||
      path: String::from(""),
 | 
			
		||||
      info: String::from(""),
 | 
			
		||||
			liveness: Some(String::from("")),
 | 
			
		||||
			liveness: Vec::new(),
 | 
			
		||||
			items: Vec::new(),
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user