3 use crate::api_schema
::schema
::*;
4 use crate::api_schema
::router
::*;
5 use serde_json
::{json}
;
15 use lazy_static
::lazy_static
;
16 use crate::tools
::common_regex
;
18 // common schema definitions
21 pub static ref IP_FORMAT
: Arc
<ApiStringFormat
> = ApiStringFormat
::Pattern(&common_regex
::IP_REGEX
).into();
23 pub static ref PVE_CONFIG_DIGEST_FORMAT
: Arc
<ApiStringFormat
> =
24 ApiStringFormat
::Pattern(&common_regex
::SHA256_HEX_REGEX
).into();
26 pub static ref PVE_CONFIG_DIGEST_SCHEMA
: Arc
<Schema
> =
27 StringSchema
::new("Prevent changes if current configuration file has different SHA256 digest. This can be used to prevent concurrent modifications.")
28 .format(PVE_CONFIG_DIGEST_FORMAT
.clone()).into();
32 pub fn router() -> Router
{
34 let nodes
= Router
::new()
35 .subdir("localhost", node
::router());
37 let route
= Router
::new()
44 {"subdir": "subscription"}
,
45 {"subdir": "version"}
,
47 ObjectSchema
::new("Directory index.")))
48 .subdir("access", access
::router())
49 .subdir("admin", admin
::router())
50 .subdir("config", config
::router())
51 .subdir("nodes", nodes
)
52 .subdir("subscription", subscription
::router())
53 .subdir("version", version
::router());