bin/proxmox-tape: add optional snapshots to restore command

and add the appropriate completion helper

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2021-05-11 12:50:06 +02:00 committed by Dietmar Maurer
parent 13f435caab
commit 0ecdaa0dc0

View File

@ -34,6 +34,7 @@ use proxmox_backup::{
MEDIA_LABEL_SCHEMA, MEDIA_LABEL_SCHEMA,
MEDIA_POOL_NAME_SCHEMA, MEDIA_POOL_NAME_SCHEMA,
Userid, Userid,
TAPE_RESTORE_SNAPSHOT_SCHEMA,
}, },
}, },
config::{ config::{
@ -51,6 +52,7 @@ use proxmox_backup::{
}, },
complete_media_label_text, complete_media_label_text,
complete_media_set_uuid, complete_media_set_uuid,
complete_media_set_snapshots,
file_formats::{ file_formats::{
PROXMOX_BACKUP_CONTENT_HEADER_MAGIC_1_0, PROXMOX_BACKUP_CONTENT_HEADER_MAGIC_1_0,
MediaContentHeader, MediaContentHeader,
@ -886,6 +888,14 @@ async fn backup(mut param: Value) -> Result<(), Error> {
type: Userid, type: Userid,
optional: true, optional: true,
}, },
"snapshots": {
description: "List of snapshots.",
type: Array,
optional: true,
items: {
schema: TAPE_RESTORE_SNAPSHOT_SCHEMA,
},
},
owner: { owner: {
type: Authid, type: Authid,
optional: true, optional: true,
@ -977,9 +987,10 @@ fn main() {
.insert( .insert(
"restore", "restore",
CliCommand::new(&API_METHOD_RESTORE) CliCommand::new(&API_METHOD_RESTORE)
.arg_param(&["media-set", "store"]) .arg_param(&["media-set", "store", "snapshots"])
.completion_cb("store", complete_datastore_name) .completion_cb("store", complete_datastore_name)
.completion_cb("media-set", complete_media_set_uuid) .completion_cb("media-set", complete_media_set_uuid)
.completion_cb("snapshots", complete_media_set_snapshots)
) )
.insert( .insert(
"barcode-label", "barcode-label",