From 157d9a45e1349d792437aed37f3b16778e5a557e Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Fri, 10 Sep 2021 09:21:27 +0200 Subject: [PATCH] move PruneOptions to pbs_api_types workspace --- pbs-api-types/src/datastore.rs | 46 ++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/pbs-api-types/src/datastore.rs b/pbs-api-types/src/datastore.rs index 039cd71a..39e44de6 100644 --- a/pbs-api-types/src/datastore.rs +++ b/pbs-api-types/src/datastore.rs @@ -119,6 +119,52 @@ pub const PRUNE_SCHEMA_KEEP_YEARLY: Schema = .minimum(1) .schema(); +#[api( + properties: { + "keep-last": { + schema: PRUNE_SCHEMA_KEEP_LAST, + optional: true, + }, + "keep-hourly": { + schema: PRUNE_SCHEMA_KEEP_HOURLY, + optional: true, + }, + "keep-daily": { + schema: PRUNE_SCHEMA_KEEP_DAILY, + optional: true, + }, + "keep-weekly": { + schema: PRUNE_SCHEMA_KEEP_WEEKLY, + optional: true, + }, + "keep-monthly": { + schema: PRUNE_SCHEMA_KEEP_MONTHLY, + optional: true, + }, + "keep-yearly": { + schema: PRUNE_SCHEMA_KEEP_YEARLY, + optional: true, + }, + } +)] +#[derive(Serialize, Deserialize, Default)] +#[serde(rename_all = "kebab-case")] +/// Common pruning options +pub struct PruneOptions { + #[serde(skip_serializing_if="Option::is_none")] + pub keep_last: Option, + #[serde(skip_serializing_if="Option::is_none")] + pub keep_hourly: Option, + #[serde(skip_serializing_if="Option::is_none")] + pub keep_daily: Option, + #[serde(skip_serializing_if="Option::is_none")] + pub keep_weekly: Option, + #[serde(skip_serializing_if="Option::is_none")] + pub keep_monthly: Option, + #[serde(skip_serializing_if="Option::is_none")] + pub keep_yearly: Option, +} + #[api( properties: { name: {