diff --git a/src/config/sync.rs b/src/config/sync.rs index d756b52c..c35f4f25 100644 --- a/src/config/sync.rs +++ b/src/config/sync.rs @@ -66,6 +66,79 @@ pub struct SyncJobConfig { pub schedule: Option, } +// FIXME: generate duplicate schemas/structs from one listing? +#[api( + properties: { + id: { + schema: JOB_ID_SCHEMA, + }, + store: { + schema: DATASTORE_SCHEMA, + }, + remote: { + schema: REMOTE_ID_SCHEMA, + }, + "remote-store": { + schema: DATASTORE_SCHEMA, + }, + "remove-vanished": { + schema: REMOVE_VANISHED_BACKUPS_SCHEMA, + optional: true, + }, + comment: { + optional: true, + schema: SINGLE_LINE_COMMENT_SCHEMA, + }, + schedule: { + optional: true, + schema: SYNC_SCHEDULE_SCHEMA, + }, + "next-run": { + description: "Estimated time of the next run (UNIX epoch).", + optional: true, + type: Integer, + }, + "last-run-state": { + description: "Result of the last run.", + optional: true, + type: String, + }, + "last-run-upid": { + description: "Task UPID of the last run.", + optional: true, + type: String, + }, + "last-run-endtime": { + description: "Endtime of the last run.", + optional: true, + type: Integer, + }, + } +)] +#[serde(rename_all="kebab-case")] +#[derive(Serialize,Deserialize)] +/// Status of Sync Job +pub struct SyncJobStatus { + pub id: String, + pub store: String, + pub remote: String, + pub remote_store: String, + #[serde(skip_serializing_if="Option::is_none")] + pub remove_vanished: Option, + #[serde(skip_serializing_if="Option::is_none")] + pub comment: Option, + #[serde(skip_serializing_if="Option::is_none")] + pub schedule: Option, + #[serde(skip_serializing_if="Option::is_none")] + pub next_run: Option, + #[serde(skip_serializing_if="Option::is_none")] + pub last_run_state: Option, + #[serde(skip_serializing_if="Option::is_none")] + pub last_run_upid: Option, + #[serde(skip_serializing_if="Option::is_none")] + pub last_run_endtime: Option, +} + fn init() -> SectionConfig { let obj_schema = match SyncJobConfig::API_SCHEMA { Schema::Object(ref obj_schema) => obj_schema,