diff --git a/src/cli.rs b/src/cli.rs index 68a2c71..3cf85ad 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -989,6 +989,9 @@ pub enum BackupCommands { Create { /// Site ID site_id: String, + /// Backup scope (full, database, files) + #[arg(long, default_value = "full")] + scope: String, /// Backup description #[arg(long)] description: Option, diff --git a/src/commands/backup.rs b/src/commands/backup.rs index 0d4dbc9..dd66a0c 100644 --- a/src/commands/backup.rs +++ b/src/commands/backup.rs @@ -16,6 +16,7 @@ struct PaginationQuery { #[derive(Debug, Serialize)] struct CreateBackupRequest { r#type: String, + scope: String, #[serde(skip_serializing_if = "Option::is_none")] description: Option, } @@ -51,6 +52,7 @@ pub fn list( vec![ b["id"].as_str().unwrap_or("-").to_string(), b["type"].as_str().unwrap_or("-").to_string(), + b["scope"].as_str().unwrap_or("-").to_string(), b["status"].as_str().unwrap_or("-").to_string(), format_option(&b["description"].as_str().map(String::from)), format_option(&b["created_at"].as_str().map(String::from)), @@ -58,7 +60,10 @@ pub fn list( }) .collect(); - print_table(vec!["ID", "Type", "Status", "Description", "Created"], rows); + print_table( + vec!["ID", "Type", "Scope", "Status", "Description", "Created"], + rows, + ); if let Some((current, last, total)) = extract_pagination(&response) { print_pagination(current, last, total); @@ -88,6 +93,7 @@ pub fn show( print_key_value(vec![ ("ID", backup["id"].as_str().unwrap_or("-").to_string()), ("Type", backup["type"].as_str().unwrap_or("-").to_string()), + ("Scope", backup["scope"].as_str().unwrap_or("-").to_string()), ( "Status", backup["status"].as_str().unwrap_or("-").to_string(), @@ -97,8 +103,12 @@ pub fn show( format_option(&backup["description"].as_str().map(String::from)), ), ( - "Snapshot ID", - format_option(&backup["snapshot_id"].as_str().map(String::from)), + "File Snapshot ID", + format_option(&backup["file_snapshot_id"].as_str().map(String::from)), + ), + ( + "Database Snapshot ID", + format_option(&backup["database_snapshot_id"].as_str().map(String::from)), ), ( "Started At", @@ -124,11 +134,13 @@ pub fn show( pub fn create( client: &ApiClient, site_id: &str, + scope: &str, description: Option, format: OutputFormat, ) -> Result<(), ApiError> { let body = CreateBackupRequest { r#type: "manual".to_string(), + scope: scope.to_string(), description, }; diff --git a/src/main.rs b/src/main.rs index 0776207..40c6512 100644 --- a/src/main.rs +++ b/src/main.rs @@ -631,8 +631,9 @@ fn run_backup(command: BackupCommands, format: OutputFormat) -> Result<(), ApiEr } BackupCommands::Create { site_id, + scope, description, - } => backup::create(&client, &site_id, description, format), + } => backup::create(&client, &site_id, &scope, description, format), } }