config: make notify a property string

For example "gc=never,verify=always,sync=error".
This commit is contained in:
Dietmar Maurer
2020-11-05 11:32:59 +01:00
parent 9e45e03aef
commit c26c9390ff
4 changed files with 87 additions and 21 deletions

View File

@ -1167,3 +1167,35 @@ pub enum Notify {
/// Send notifications for failed jobs only
Error,
}
#[api(
properties: {
gc: {
type: Notify,
optional: true,
},
verify: {
type: Notify,
optional: true,
},
sync: {
type: Notify,
optional: true,
},
},
)]
#[derive(Debug, Serialize, Deserialize)]
/// Datastore notify settings
pub struct DatastoreNotify {
/// Garbage collection settings
pub gc: Option<Notify>,
/// Verify job setting
pub verify: Option<Notify>,
/// Sync job setting
pub sync: Option<Notify>,
}
pub const DATASTORE_NOTIFY_STRING_SCHEMA: Schema = StringSchema::new(
"Datastore notification setting")
.format(&ApiStringFormat::PropertyString(&DatastoreNotify::API_SCHEMA))
.schema();