use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct StorageBox {
#[serde(rename = "access_settings")]
pub access_settings: Box<models::StorageBoxAccessSetting>,
#[serde(rename = "created")]
pub created: String,
#[serde(rename = "id")]
pub id: i64,
#[serde(rename = "labels")]
pub labels: std::collections::HashMap<String, String>,
#[serde(rename = "location")]
pub location: Box<models::Location>,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "protection")]
pub protection: Box<models::Protection>,
#[serde(rename = "server", deserialize_with = "Option::deserialize")]
pub server: Option<String>,
#[serde(rename = "snapshot_plan", deserialize_with = "Option::deserialize")]
pub snapshot_plan: Option<Box<models::SnapshotPlan>>,
#[serde(rename = "stats")]
pub stats: Box<models::StorageBoxStats>,
#[serde(rename = "status")]
pub status: Status,
#[serde(rename = "storage_box_type")]
pub storage_box_type: Box<models::StorageBoxType>,
#[serde(rename = "system", deserialize_with = "Option::deserialize")]
pub system: Option<String>,
#[serde(rename = "username", deserialize_with = "Option::deserialize")]
pub username: Option<String>,
}
impl StorageBox {
pub fn new(
access_settings: models::StorageBoxAccessSetting,
created: String,
id: i64,
labels: std::collections::HashMap<String, String>,
location: models::Location,
name: String,
protection: models::Protection,
server: Option<String>,
snapshot_plan: Option<models::SnapshotPlan>,
stats: models::StorageBoxStats,
status: Status,
storage_box_type: models::StorageBoxType,
system: Option<String>,
username: Option<String>,
) -> StorageBox {
StorageBox {
access_settings: Box::new(access_settings),
created,
id,
labels,
location: Box::new(location),
name,
protection: Box::new(protection),
server,
snapshot_plan: snapshot_plan.map(Box::new),
stats: Box::new(stats),
status,
storage_box_type: Box::new(storage_box_type),
system,
username,
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
#[serde(rename = "active")]
Active,
#[serde(rename = "initializing")]
Initializing,
#[serde(rename = "locked")]
Locked,
}
impl Default for Status {
fn default() -> Status {
Self::Active
}
}