api_v1_platforms_subroutes_status - OmniCloudOrg/OmniOrchestrator GitHub Wiki
Path: src/api/v1/platforms/subroutes/status.rs
pub fn check_platform_status(cloud_name: String) -> Json<ApiResponse> {
let host_status = {
let deployment_status = GLOBAL_DEPLOYMENT_STATUS.read().unwrap();
deployment_status.get(&cloud_name).cloned()
};
if let Some(host_status) = host_status {
let overall_progress = host_status.iter()
.map(|h| h.progress as u32)
.sum::<u32>() / host_status.len() as u32;
let all_completed = host_status.iter().all(|h| h.completed);
let status = if all_completed { "completed" } else { "in_progress" };
return Json(ApiResponse {
status: status.to_string(),
message: format!("Platform deployment is {}% complete", overall_progress),
data: Some(serde_json::to_value(host_status).unwrap()),
});
}
// ... function definition continues
// ... function body
}