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",
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 )*
]

View File

@ -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": {