src/api2/types.rs: use separate file for schema definitions

This commit is contained in:
Dietmar Maurer
2019-05-09 07:44:09 +02:00
parent bd1507c4fa
commit 4ebf0eabb0
9 changed files with 77 additions and 78 deletions

View File

@ -1,10 +1,4 @@
use failure::*;
use crate::tools;
use crate::api_schema::*;
use crate::api_schema::router::*;
use lazy_static::lazy_static;
use std::sync::Arc;
mod tasks;
mod time;
@ -13,23 +7,6 @@ mod dns;
mod syslog;
mod services;
lazy_static!{
pub static ref NODE_SCHEMA: Arc<Schema> = Arc::new(
StringSchema::new("Node name (or 'localhost')")
.format(
Arc::new(ApiStringFormat::VerifyFn(|node| {
if node == "localhost" || node == tools::nodename() {
Ok(())
} else {
Err(format_err!("no such node '{}'", node))
}
}))
)
.into()
);
}
pub fn router() -> Router {
let route = Router::new()