src/api2/types.rs: define CHUNK_DIGEST_SCHEMA

This commit is contained in:
Dietmar Maurer 2019-06-13 07:30:42 +02:00
parent b595cb9d2c
commit 6762db70d6
2 changed files with 10 additions and 4 deletions

View File

@ -16,6 +16,7 @@ use crate::api_schema::router::*;
use crate::api_schema::*; use crate::api_schema::*;
use crate::server::WorkerTask; use crate::server::WorkerTask;
use crate::backup::*; use crate::backup::*;
use crate::api2::types::*;
mod environment; mod environment;
use environment::*; use environment::*;
@ -291,8 +292,7 @@ pub fn api_method_dynamic_append() -> ApiMethod {
.maximum(256) .maximum(256)
) )
.required("digest-list", ArraySchema::new( .required("digest-list", ArraySchema::new(
"Chunk digest list.", "Chunk digest list.", CHUNK_DIGEST_SCHEMA.clone())
StringSchema::new("Chunk digest.").into())
) )
.required("offset-list", ArraySchema::new( .required("offset-list", ArraySchema::new(
"Chunk offset list.", "Chunk offset list.",
@ -344,8 +344,7 @@ pub fn api_method_fixed_append() -> ApiMethod {
.maximum(256) .maximum(256)
) )
.required("digest-list", ArraySchema::new( .required("digest-list", ArraySchema::new(
"Chunk digest list.", "Chunk digest list.", CHUNK_DIGEST_SCHEMA.clone())
StringSchema::new("Chunk digest.").into())
) )
.required("offset-list", ArraySchema::new( .required("offset-list", ArraySchema::new(
"Chunk offset list.", "Chunk offset list.",

View File

@ -27,6 +27,13 @@ lazy_static!{
StringSchema::new("Prevent changes if current configuration file has different SHA256 digest. This can be used to prevent concurrent modifications.") StringSchema::new("Prevent changes if current configuration file has different SHA256 digest. This can be used to prevent concurrent modifications.")
.format(PVE_CONFIG_DIGEST_FORMAT.clone()).into(); .format(PVE_CONFIG_DIGEST_FORMAT.clone()).into();
pub static ref CHUNK_DIGEST_FORMAT: Arc<ApiStringFormat> =
ApiStringFormat::Pattern(&common_regex::SHA256_HEX_REGEX).into();
pub static ref CHUNK_DIGEST_SCHEMA: Arc<Schema> =
StringSchema::new("Chunk digest (SHA256).")
.format(CHUNK_DIGEST_FORMAT.clone()).into();
pub static ref NODE_SCHEMA: Arc<Schema> = Arc::new( pub static ref NODE_SCHEMA: Arc<Schema> = Arc::new(
StringSchema::new("Node name (or 'localhost')") StringSchema::new("Node name (or 'localhost')")
.format( .format(