mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 20:43:41 +00:00
* rename frontend to web and update contributing guide * rename this time * fix build * restructure rust code * update documentation * update descriptions * Update CONTRIBUTING.md Co-authored-by: J H <2364004+Blu-J@users.noreply.github.com> --------- Co-authored-by: Aiden McClelland <me@drbonez.dev> Co-authored-by: Aiden McClelland <3732071+dr-bonez@users.noreply.github.com> Co-authored-by: J H <2364004+Blu-J@users.noreply.github.com>
58 lines
2.4 KiB
Rust
58 lines
2.4 KiB
Rust
use serde::{Deserialize, Serialize};
|
|
|
|
use crate::{ActionId, HealthCheckId, PackageId};
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub enum ProcedureName {
|
|
Main, // Usually just run container
|
|
CreateBackup,
|
|
RestoreBackup,
|
|
GetConfig,
|
|
SetConfig,
|
|
Migration,
|
|
Properties,
|
|
LongRunning,
|
|
Check(PackageId),
|
|
AutoConfig(PackageId),
|
|
Health(HealthCheckId),
|
|
Action(ActionId),
|
|
Signal,
|
|
}
|
|
|
|
impl ProcedureName {
|
|
pub fn docker_name(&self) -> Option<String> {
|
|
match self {
|
|
ProcedureName::Main => None,
|
|
ProcedureName::LongRunning => None,
|
|
ProcedureName::CreateBackup => Some("CreateBackup".to_string()),
|
|
ProcedureName::RestoreBackup => Some("RestoreBackup".to_string()),
|
|
ProcedureName::GetConfig => Some("GetConfig".to_string()),
|
|
ProcedureName::SetConfig => Some("SetConfig".to_string()),
|
|
ProcedureName::Migration => Some("Migration".to_string()),
|
|
ProcedureName::Properties => Some(format!("Properties-{}", rand::random::<u64>())),
|
|
ProcedureName::Health(id) => Some(format!("{}Health", id)),
|
|
ProcedureName::Action(id) => Some(format!("{}Action", id)),
|
|
ProcedureName::Check(_) => None,
|
|
ProcedureName::AutoConfig(_) => None,
|
|
ProcedureName::Signal => None,
|
|
}
|
|
}
|
|
pub fn js_function_name(&self) -> Option<String> {
|
|
match self {
|
|
ProcedureName::Main => Some("/main".to_string()),
|
|
ProcedureName::LongRunning => None,
|
|
ProcedureName::CreateBackup => Some("/createBackup".to_string()),
|
|
ProcedureName::RestoreBackup => Some("/restoreBackup".to_string()),
|
|
ProcedureName::GetConfig => Some("/getConfig".to_string()),
|
|
ProcedureName::SetConfig => Some("/setConfig".to_string()),
|
|
ProcedureName::Migration => Some("/migration".to_string()),
|
|
ProcedureName::Properties => Some("/properties".to_string()),
|
|
ProcedureName::Health(id) => Some(format!("/health/{}", id)),
|
|
ProcedureName::Action(id) => Some(format!("/action/{}", id)),
|
|
ProcedureName::Check(id) => Some(format!("/dependencies/{}/check", id)),
|
|
ProcedureName::AutoConfig(id) => Some(format!("/dependencies/{}/autoConfigure", id)),
|
|
ProcedureName::Signal => Some("/handleSignal".to_string()),
|
|
}
|
|
}
|
|
}
|