src/api_schema/router.rs: add docu for RpcEnvironmentType

This commit is contained in:
Dietmar Maurer 2019-02-17 11:59:18 +01:00
parent d21c2710da
commit 51ebd07974
2 changed files with 11 additions and 5 deletions

View File

@ -32,14 +32,20 @@ pub trait RpcEnvironment {
fn get_user(&self) -> Option<String>; fn get_user(&self) -> Option<String>;
} }
/// Environment Type
///
/// We use this to enumerate the different environment types. Some methods
/// needs to do different things when started from the command line interface,
/// or when executed from a privileged server running as root.
#[derive(PartialEq, Copy, Clone)] #[derive(PartialEq, Copy, Clone)]
pub enum RpcEnvironmentType { pub enum RpcEnvironmentType {
/// command started from command line /// Command started from command line
CLI, CLI,
/// access from public acessable server /// Access from public accessible server
PUBLIC, PUBLIC,
/// ... access from priviledged server (run as root) /// Access from privileged server (run as root)
PRIVILEDGED, PRIVILEGED,
} }
#[derive(Debug, Fail)] #[derive(Debug, Fail)]

View File

@ -50,7 +50,7 @@ fn run() -> Result<(), Error> {
} }
let config = ApiConfig::new( let config = ApiConfig::new(
env!("PROXMOX_JSDIR"), &ROUTER, RpcEnvironmentType::PRIVILEDGED); env!("PROXMOX_JSDIR"), &ROUTER, RpcEnvironmentType::PRIVILEGED);
let rest_server = RestServer::new(config); let rest_server = RestServer::new(config);