src/api2/types.rs: define PRUNE_SCHEMA_KEEP_*

This commit is contained in:
Dietmar Maurer 2020-05-20 10:13:38 +02:00
parent 479e4932b5
commit 49ff10921c
2 changed files with 36 additions and 18 deletions

View File

@ -411,44 +411,32 @@ macro_rules! add_common_prune_prameters {
( (
"keep-daily", "keep-daily",
true, true,
&IntegerSchema::new("Number of daily backups to keep.") &PRUNE_SCHEMA_KEEP_DAILY,
.minimum(1)
.schema()
), ),
( (
"keep-hourly", "keep-hourly",
true, true,
&IntegerSchema::new("Number of hourly backups to keep.") &PRUNE_SCHEMA_KEEP_HOURLY,
.minimum(1)
.schema()
), ),
( (
"keep-last", "keep-last",
true, true,
&IntegerSchema::new("Number of backups to keep.") &PRUNE_SCHEMA_KEEP_LAST,
.minimum(1)
.schema()
), ),
( (
"keep-monthly", "keep-monthly",
true, true,
&IntegerSchema::new("Number of monthly backups to keep.") &PRUNE_SCHEMA_KEEP_MONTHLY,
.minimum(1)
.schema()
), ),
( (
"keep-weekly", "keep-weekly",
true, true,
&IntegerSchema::new("Number of weekly backups to keep.") &PRUNE_SCHEMA_KEEP_WEEKLY,
.minimum(1)
.schema()
), ),
( (
"keep-yearly", "keep-yearly",
true, true,
&IntegerSchema::new("Number of yearly backups to keep.") &PRUNE_SCHEMA_KEEP_YEARLY,
.minimum(1)
.schema()
), ),
$( $list2 )* $( $list2 )*
] ]

View File

@ -421,6 +421,36 @@ pub struct PruneListItem {
pub keep: bool, 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( #[api(
properties: { properties: {
"filename": { "filename": {