diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs index 3fe91985..d6e96b62 100644 --- a/src/api2/admin/datastore.rs +++ b/src/api2/admin/datastore.rs @@ -411,44 +411,32 @@ macro_rules! add_common_prune_prameters { ( "keep-daily", true, - &IntegerSchema::new("Number of daily backups to keep.") - .minimum(1) - .schema() + &PRUNE_SCHEMA_KEEP_DAILY, ), ( "keep-hourly", true, - &IntegerSchema::new("Number of hourly backups to keep.") - .minimum(1) - .schema() + &PRUNE_SCHEMA_KEEP_HOURLY, ), ( "keep-last", true, - &IntegerSchema::new("Number of backups to keep.") - .minimum(1) - .schema() + &PRUNE_SCHEMA_KEEP_LAST, ), ( "keep-monthly", true, - &IntegerSchema::new("Number of monthly backups to keep.") - .minimum(1) - .schema() + &PRUNE_SCHEMA_KEEP_MONTHLY, ), ( "keep-weekly", true, - &IntegerSchema::new("Number of weekly backups to keep.") - .minimum(1) - .schema() + &PRUNE_SCHEMA_KEEP_WEEKLY, ), ( "keep-yearly", true, - &IntegerSchema::new("Number of yearly backups to keep.") - .minimum(1) - .schema() + &PRUNE_SCHEMA_KEEP_YEARLY, ), $( $list2 )* ] diff --git a/src/api2/types.rs b/src/api2/types.rs index d3ad88c7..1ec49593 100644 --- a/src/api2/types.rs +++ b/src/api2/types.rs @@ -421,6 +421,36 @@ pub struct PruneListItem { pub keep: bool, } +pub const PRUNE_SCHEMA_KEEP_DAILY: Schema = IntegerSchema::new( + "Number of daily backups to keep.") + .minimum(1) + .schema(); + +pub const PRUNE_SCHEMA_KEEP_HOURLY: Schema = IntegerSchema::new( + "Number of hourly backups to keep.") + .minimum(1) + .schema(); + +pub const PRUNE_SCHEMA_KEEP_LAST: Schema = IntegerSchema::new( + "Number of backups to keep.") + .minimum(1) + .schema(); + +pub const PRUNE_SCHEMA_KEEP_MONTHLY: Schema = IntegerSchema::new( + "Number of monthly backups to keep.") + .minimum(1) + .schema(); + +pub const PRUNE_SCHEMA_KEEP_WEEKLY: Schema = IntegerSchema::new( + "Number of weekly backups to keep.") + .minimum(1) + .schema(); + +pub const PRUNE_SCHEMA_KEEP_YEARLY: Schema = IntegerSchema::new( + "Number of yearly backups to keep.") + .minimum(1) + .schema(); + #[api( properties: { "filename": {