mirror of
https://git.proxmox.com/git/proxmox-backup
synced 2025-08-04 07:06:14 +00:00
derive Clone and PartialEq for some API types
This is useful for react-lik GUI toolkits which need to do VDOM diffs. Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
parent
6c03b0ae4c
commit
aca9222e35
@ -270,7 +270,7 @@ pub const DATASTORE_TUNING_STRING_SCHEMA: Schema = StringSchema::new("Datastore
|
||||
},
|
||||
}
|
||||
)]
|
||||
#[derive(Serialize, Deserialize, Updater)]
|
||||
#[derive(Serialize, Deserialize, Updater, Clone, PartialEq)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
/// Datastore configuration properties.
|
||||
pub struct DataStoreConfig {
|
||||
@ -354,7 +354,7 @@ impl DataStoreConfig {
|
||||
}
|
||||
},
|
||||
)]
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[derive(Serialize, Deserialize, Clone, PartialEq)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
/// Basic information about a datastore.
|
||||
pub struct DataStoreListItem {
|
||||
@ -1141,7 +1141,7 @@ pub struct GroupListItem {
|
||||
}
|
||||
|
||||
#[api()]
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[derive(Serialize, Deserialize, Clone, PartialEq)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
/// Basic information about a backup namespace.
|
||||
pub struct NamespaceListItem {
|
||||
@ -1223,7 +1223,7 @@ pub struct TypeCounts {
|
||||
},
|
||||
},
|
||||
)]
|
||||
#[derive(Clone, Default, Serialize, Deserialize)]
|
||||
#[derive(Clone, Default, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
/// Garbage collection status.
|
||||
pub struct GarbageCollectionStatus {
|
||||
@ -1295,7 +1295,7 @@ pub struct DataStoreStatus {
|
||||
},
|
||||
},
|
||||
)]
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[derive(Serialize, Deserialize, Clone, PartialEq)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
/// Status of a Datastore
|
||||
pub struct DataStoreStatusListItem {
|
||||
|
@ -121,7 +121,7 @@ fn strip_unit(v: &str) -> (&str, SizeUnit) {
|
||||
}
|
||||
|
||||
/// Byte size which can be displayed in a human friendly way
|
||||
#[derive(Debug, Copy, Clone, UpdaterType)]
|
||||
#[derive(Debug, Copy, Clone, UpdaterType, PartialEq)]
|
||||
pub struct HumanByte {
|
||||
/// The siginficant value, it does not includes any factor of the `unit`
|
||||
size: f64,
|
||||
|
@ -87,7 +87,7 @@ pub const REMOVE_VANISHED_BACKUPS_SCHEMA: Schema = BooleanSchema::new(
|
||||
},
|
||||
}
|
||||
)]
|
||||
#[derive(Serialize, Deserialize, Default)]
|
||||
#[derive(Serialize, Deserialize, Default, Clone, PartialEq)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
/// Job Scheduling Status
|
||||
pub struct JobScheduleStatus {
|
||||
@ -392,6 +392,17 @@ pub enum GroupFilter {
|
||||
Regex(Regex),
|
||||
}
|
||||
|
||||
impl PartialEq for GroupFilter {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
match (self, other) {
|
||||
(Self::BackupType(a), Self::BackupType(b)) => a == b,
|
||||
(Self::Group(a), Self::Group(b)) => a == b,
|
||||
(Self::Regex(a), Self::Regex(b)) => a.as_str() == b.as_str(),
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::str::FromStr for GroupFilter {
|
||||
type Err = anyhow::Error;
|
||||
|
||||
@ -484,7 +495,7 @@ pub const GROUP_FILTER_LIST_SCHEMA: Schema =
|
||||
},
|
||||
}
|
||||
)]
|
||||
#[derive(Serialize, Deserialize, Clone, Updater)]
|
||||
#[derive(Serialize, Deserialize, Clone, Updater, PartialEq)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
/// Sync Job
|
||||
pub struct SyncJobConfig {
|
||||
@ -532,7 +543,7 @@ impl SyncJobConfig {
|
||||
},
|
||||
},
|
||||
)]
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[derive(Serialize, Deserialize, Clone, PartialEq)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
/// Status of Sync Job
|
||||
pub struct SyncJobStatus {
|
||||
@ -572,7 +583,7 @@ pub struct SyncJobStatus {
|
||||
},
|
||||
}
|
||||
)]
|
||||
#[derive(Serialize, Deserialize, Default, Updater)]
|
||||
#[derive(Serialize, Deserialize, Default, Updater, Clone, PartialEq)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
/// Common pruning options
|
||||
pub struct KeepOptions {
|
||||
|
@ -492,7 +492,7 @@ pub enum RRDTimeFrame {
|
||||
}
|
||||
|
||||
#[api]
|
||||
#[derive(Deserialize, Serialize, PartialEq, Eq)]
|
||||
#[derive(Deserialize, Serialize, Copy, Clone, PartialEq, Eq)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
/// type of the realm
|
||||
pub enum RealmType {
|
||||
@ -518,7 +518,7 @@ pub enum RealmType {
|
||||
},
|
||||
},
|
||||
)]
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[derive(Deserialize, Serialize, Clone, PartialEq)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
/// Basic Information about a realm
|
||||
pub struct BasicRealmInfo {
|
||||
|
@ -46,7 +46,7 @@ pub const REMOTE_ID_SCHEMA: Schema = StringSchema::new("Remote ID.")
|
||||
},
|
||||
},
|
||||
)]
|
||||
#[derive(Serialize, Deserialize, Updater)]
|
||||
#[derive(Serialize, Deserialize, Updater, Clone, PartialEq)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
/// Remote configuration properties.
|
||||
pub struct RemoteConfig {
|
||||
@ -96,7 +96,7 @@ pub struct Remote {
|
||||
},
|
||||
},
|
||||
)]
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[derive(Serialize, Deserialize, Clone, PartialEq)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
/// Remote properties.
|
||||
pub struct RemoteWithoutPassword {
|
||||
|
@ -149,7 +149,7 @@ pub struct LabelUuidMap {
|
||||
},
|
||||
},
|
||||
)]
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[derive(Serialize, Deserialize, Clone, PartialEq)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
/// Media content list entry
|
||||
pub struct MediaContentEntry {
|
||||
|
@ -48,7 +48,7 @@ pub const TRAFFIC_CONTROL_BURST_SCHEMA: Schema =
|
||||
},
|
||||
},
|
||||
)]
|
||||
#[derive(Serialize, Deserialize, Default, Clone, Updater)]
|
||||
#[derive(Serialize, Deserialize, Default, Clone, Updater, PartialEq)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
/// Rate Limit Configuration
|
||||
pub struct RateLimitConfig {
|
||||
|
@ -75,7 +75,7 @@ pub const EMAIL_SCHEMA: Schema = StringSchema::new("E-Mail Address.")
|
||||
},
|
||||
}
|
||||
)]
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[derive(Serialize, Deserialize, Clone, PartialEq)]
|
||||
/// User properties with added list of ApiTokens
|
||||
pub struct UserWithTokens {
|
||||
pub userid: Userid,
|
||||
@ -114,7 +114,7 @@ pub struct UserWithTokens {
|
||||
},
|
||||
}
|
||||
)]
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[derive(Serialize, Deserialize, Clone, PartialEq)]
|
||||
/// ApiToken properties.
|
||||
pub struct ApiToken {
|
||||
pub tokenid: Authid,
|
||||
|
Loading…
Reference in New Issue
Block a user