src/bin/proxmox-backup-client.rs: use new ApiHandler::Async
This commit is contained in:
parent
b9799012cf
commit
8a8a470316
@ -10,7 +10,7 @@ use std::os::unix::fs::OpenOptionsExt;
|
|||||||
|
|
||||||
use proxmox::{sortable, identity};
|
use proxmox::{sortable, identity};
|
||||||
use proxmox::tools::fs::{file_get_contents, file_get_json, file_set_contents, image_size};
|
use proxmox::tools::fs::{file_get_contents, file_get_json, file_set_contents, image_size};
|
||||||
use proxmox::api::{ApiHandler, ApiMethod, RpcEnvironment};
|
use proxmox::api::{ApiFuture, ApiHandler, ApiMethod, RpcEnvironment};
|
||||||
use proxmox::api::schema::*;
|
use proxmox::api::schema::*;
|
||||||
use proxmox::api::cli::*;
|
use proxmox::api::cli::*;
|
||||||
use proxmox::api::api;
|
use proxmox::api::api;
|
||||||
@ -233,11 +233,18 @@ fn strip_server_file_expenstion(name: &str) -> String {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn list_backup_groups(
|
fn list_backup_groups<'a>(
|
||||||
param: Value,
|
param: Value,
|
||||||
_info: &ApiMethod,
|
_info: &ApiMethod,
|
||||||
_rpcenv: &mut dyn RpcEnvironment,
|
_rpcenv: &'a mut dyn RpcEnvironment,
|
||||||
) -> Result<Value, Error> {
|
) -> ApiFuture<'a> {
|
||||||
|
|
||||||
|
async move {
|
||||||
|
list_backup_groups_async(param).await
|
||||||
|
}.boxed()
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn list_backup_groups_async(param: Value) -> Result<Value, Error> {
|
||||||
|
|
||||||
let repo = extract_repository_from_value(¶m)?;
|
let repo = extract_repository_from_value(¶m)?;
|
||||||
|
|
||||||
@ -245,9 +252,7 @@ fn list_backup_groups(
|
|||||||
|
|
||||||
let path = format!("api2/json/admin/datastore/{}/groups", repo.store());
|
let path = format!("api2/json/admin/datastore/{}/groups", repo.store());
|
||||||
|
|
||||||
let mut result = async_main(async move {
|
let mut result = client.get(&path, None).await?;
|
||||||
client.get(&path, None).await
|
|
||||||
})?;
|
|
||||||
|
|
||||||
record_repository(&repo);
|
record_repository(&repo);
|
||||||
|
|
||||||
@ -311,11 +316,18 @@ fn list_backup_groups(
|
|||||||
Ok(Value::Null)
|
Ok(Value::Null)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn list_snapshots(
|
fn list_snapshots<'a>(
|
||||||
param: Value,
|
param: Value,
|
||||||
_info: &ApiMethod,
|
_info: &ApiMethod,
|
||||||
_rpcenv: &mut dyn RpcEnvironment,
|
_rpcenv: &'a mut dyn RpcEnvironment,
|
||||||
) -> Result<Value, Error> {
|
) -> ApiFuture<'a> {
|
||||||
|
|
||||||
|
async move {
|
||||||
|
list_snapshots_async(param).await
|
||||||
|
}.boxed()
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn list_snapshots_async(param: Value) -> Result<Value, Error> {
|
||||||
|
|
||||||
let repo = extract_repository_from_value(¶m)?;
|
let repo = extract_repository_from_value(¶m)?;
|
||||||
|
|
||||||
@ -332,9 +344,7 @@ fn list_snapshots(
|
|||||||
args["backup-id"] = group.backup_id().into();
|
args["backup-id"] = group.backup_id().into();
|
||||||
}
|
}
|
||||||
|
|
||||||
let result = async_main(async move {
|
let result = client.get(&path, Some(args)).await?;
|
||||||
client.get(&path, Some(args)).await
|
|
||||||
})?;
|
|
||||||
|
|
||||||
record_repository(&repo);
|
record_repository(&repo);
|
||||||
|
|
||||||
@ -381,11 +391,18 @@ fn list_snapshots(
|
|||||||
Ok(Value::Null)
|
Ok(Value::Null)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn forget_snapshots(
|
fn forget_snapshots<'a>(
|
||||||
param: Value,
|
param: Value,
|
||||||
_info: &ApiMethod,
|
_info: &ApiMethod,
|
||||||
_rpcenv: &mut dyn RpcEnvironment,
|
_rpcenv: &'a mut dyn RpcEnvironment,
|
||||||
) -> Result<Value, Error> {
|
) -> ApiFuture<'a> {
|
||||||
|
|
||||||
|
async move {
|
||||||
|
forget_snapshots_async(param).await
|
||||||
|
}.boxed()
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn forget_snapshots_async(param: Value) -> Result<Value, Error> {
|
||||||
|
|
||||||
let repo = extract_repository_from_value(¶m)?;
|
let repo = extract_repository_from_value(¶m)?;
|
||||||
|
|
||||||
@ -396,29 +413,34 @@ fn forget_snapshots(
|
|||||||
|
|
||||||
let path = format!("api2/json/admin/datastore/{}/snapshots", repo.store());
|
let path = format!("api2/json/admin/datastore/{}/snapshots", repo.store());
|
||||||
|
|
||||||
let result = async_main(async move {
|
let result = client.delete(&path, Some(json!({
|
||||||
client.delete(&path, Some(json!({
|
|
||||||
"backup-type": snapshot.group().backup_type(),
|
"backup-type": snapshot.group().backup_type(),
|
||||||
"backup-id": snapshot.group().backup_id(),
|
"backup-id": snapshot.group().backup_id(),
|
||||||
"backup-time": snapshot.backup_time().timestamp(),
|
"backup-time": snapshot.backup_time().timestamp(),
|
||||||
}))).await
|
}))).await?;
|
||||||
})?;
|
|
||||||
|
|
||||||
record_repository(&repo);
|
record_repository(&repo);
|
||||||
|
|
||||||
Ok(result)
|
Ok(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn api_login(
|
fn api_login<'a>(
|
||||||
param: Value,
|
param: Value,
|
||||||
_info: &ApiMethod,
|
_info: &ApiMethod,
|
||||||
_rpcenv: &mut dyn RpcEnvironment,
|
_rpcenv: &'a mut dyn RpcEnvironment,
|
||||||
) -> Result<Value, Error> {
|
) -> ApiFuture<'a> {
|
||||||
|
|
||||||
|
async move {
|
||||||
|
api_login_async(param).await
|
||||||
|
}.boxed()
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn api_login_async(param: Value) -> Result<Value, Error> {
|
||||||
|
|
||||||
let repo = extract_repository_from_value(¶m)?;
|
let repo = extract_repository_from_value(¶m)?;
|
||||||
|
|
||||||
let client = HttpClient::new(repo.host(), repo.user(), None)?;
|
let client = HttpClient::new(repo.host(), repo.user(), None)?;
|
||||||
async_main(async move { client.login().await })?;
|
client.login().await?;
|
||||||
|
|
||||||
record_repository(&repo);
|
record_repository(&repo);
|
||||||
|
|
||||||
@ -438,11 +460,18 @@ fn api_logout(
|
|||||||
Ok(Value::Null)
|
Ok(Value::Null)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dump_catalog(
|
fn dump_catalog<'a>(
|
||||||
param: Value,
|
param: Value,
|
||||||
_info: &ApiMethod,
|
_info: &ApiMethod,
|
||||||
_rpcenv: &mut dyn RpcEnvironment,
|
_rpcenv: &'a mut dyn RpcEnvironment,
|
||||||
) -> Result<Value, Error> {
|
) -> ApiFuture<'a> {
|
||||||
|
|
||||||
|
async move {
|
||||||
|
dump_catalog_async(param).await
|
||||||
|
}.boxed()
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn dump_catalog_async(param: Value) -> Result<Value, Error> {
|
||||||
|
|
||||||
let repo = extract_repository_from_value(¶m)?;
|
let repo = extract_repository_from_value(¶m)?;
|
||||||
|
|
||||||
@ -461,7 +490,6 @@ fn dump_catalog(
|
|||||||
|
|
||||||
let client = HttpClient::new(repo.host(), repo.user(), None)?;
|
let client = HttpClient::new(repo.host(), repo.user(), None)?;
|
||||||
|
|
||||||
async_main(async move {
|
|
||||||
let client = BackupReader::start(
|
let client = BackupReader::start(
|
||||||
client,
|
client,
|
||||||
crypt_config.clone(),
|
crypt_config.clone(),
|
||||||
@ -499,17 +527,21 @@ fn dump_catalog(
|
|||||||
|
|
||||||
record_repository(&repo);
|
record_repository(&repo);
|
||||||
|
|
||||||
Ok::<(), Error>(())
|
|
||||||
})?;
|
|
||||||
|
|
||||||
Ok(Value::Null)
|
Ok(Value::Null)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn list_snapshot_files(
|
fn list_snapshot_files<'a>(
|
||||||
param: Value,
|
param: Value,
|
||||||
_info: &ApiMethod,
|
_info: &ApiMethod,
|
||||||
_rpcenv: &mut dyn RpcEnvironment,
|
_rpcenv: &'a mut dyn RpcEnvironment,
|
||||||
) -> Result<Value, Error> {
|
) -> ApiFuture<'a> {
|
||||||
|
|
||||||
|
async move {
|
||||||
|
list_snapshot_files_async(param).await
|
||||||
|
}.boxed()
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn list_snapshot_files_async(param: Value) -> Result<Value, Error> {
|
||||||
|
|
||||||
let repo = extract_repository_from_value(¶m)?;
|
let repo = extract_repository_from_value(¶m)?;
|
||||||
|
|
||||||
@ -522,13 +554,11 @@ fn list_snapshot_files(
|
|||||||
|
|
||||||
let path = format!("api2/json/admin/datastore/{}/files", repo.store());
|
let path = format!("api2/json/admin/datastore/{}/files", repo.store());
|
||||||
|
|
||||||
let mut result = async_main(async move {
|
let mut result = client.get(&path, Some(json!({
|
||||||
client.get(&path, Some(json!({
|
|
||||||
"backup-type": snapshot.group().backup_type(),
|
"backup-type": snapshot.group().backup_type(),
|
||||||
"backup-id": snapshot.group().backup_id(),
|
"backup-id": snapshot.group().backup_id(),
|
||||||
"backup-time": snapshot.backup_time().timestamp(),
|
"backup-time": snapshot.backup_time().timestamp(),
|
||||||
}))).await
|
}))).await?;
|
||||||
})?;
|
|
||||||
|
|
||||||
record_repository(&repo);
|
record_repository(&repo);
|
||||||
|
|
||||||
@ -549,7 +579,18 @@ fn list_snapshot_files(
|
|||||||
Ok(Value::Null)
|
Ok(Value::Null)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn start_garbage_collection(
|
fn start_garbage_collection<'a>(
|
||||||
|
param: Value,
|
||||||
|
info: &'static ApiMethod,
|
||||||
|
rpcenv: &'a mut dyn RpcEnvironment,
|
||||||
|
) -> ApiFuture<'a> {
|
||||||
|
|
||||||
|
async move {
|
||||||
|
start_garbage_collection_async(param, info, rpcenv).await
|
||||||
|
}.boxed()
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn start_garbage_collection_async(
|
||||||
param: Value,
|
param: Value,
|
||||||
_info: &ApiMethod,
|
_info: &ApiMethod,
|
||||||
_rpcenv: &mut dyn RpcEnvironment,
|
_rpcenv: &mut dyn RpcEnvironment,
|
||||||
@ -562,13 +603,11 @@ fn start_garbage_collection(
|
|||||||
|
|
||||||
let path = format!("api2/json/admin/datastore/{}/gc", repo.store());
|
let path = format!("api2/json/admin/datastore/{}/gc", repo.store());
|
||||||
|
|
||||||
async_main(async {
|
|
||||||
let result = client.post(&path, None).await?;
|
let result = client.post(&path, None).await?;
|
||||||
|
|
||||||
record_repository(&repo);
|
record_repository(&repo);
|
||||||
|
|
||||||
view_task_result(client, result, &output_format).await
|
view_task_result(client, result, &output_format).await?;
|
||||||
})?;
|
|
||||||
|
|
||||||
Ok(Value::Null)
|
Ok(Value::Null)
|
||||||
}
|
}
|
||||||
@ -615,7 +654,18 @@ fn spawn_catalog_upload(
|
|||||||
Ok((catalog, catalog_result_rx))
|
Ok((catalog, catalog_result_rx))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_backup(
|
fn create_backup<'a>(
|
||||||
|
param: Value,
|
||||||
|
info: &'static ApiMethod,
|
||||||
|
rpcenv: &'a mut dyn RpcEnvironment,
|
||||||
|
) -> ApiFuture<'a> {
|
||||||
|
|
||||||
|
async move {
|
||||||
|
create_backup_async(param, info, rpcenv).await
|
||||||
|
}.boxed()
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn create_backup_async(
|
||||||
param: Value,
|
param: Value,
|
||||||
_info: &ApiMethod,
|
_info: &ApiMethod,
|
||||||
_rpcenv: &mut dyn RpcEnvironment,
|
_rpcenv: &mut dyn RpcEnvironment,
|
||||||
@ -752,7 +802,6 @@ fn create_backup(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
async_main(async move {
|
|
||||||
let client = BackupWriter::start(
|
let client = BackupWriter::start(
|
||||||
client,
|
client,
|
||||||
repo.store(),
|
repo.store(),
|
||||||
@ -867,7 +916,6 @@ fn create_backup(
|
|||||||
println!("End Time: {}", end_time.to_rfc3339_opts(chrono::SecondsFormat::Secs, false));
|
println!("End Time: {}", end_time.to_rfc3339_opts(chrono::SecondsFormat::Secs, false));
|
||||||
|
|
||||||
Ok(Value::Null)
|
Ok(Value::Null)
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn complete_backup_source(arg: &str, param: &HashMap<String, String>) -> Vec<String> {
|
fn complete_backup_source(arg: &str, param: &HashMap<String, String>) -> Vec<String> {
|
||||||
@ -891,14 +939,6 @@ fn complete_backup_source(arg: &str, param: &HashMap<String, String>) -> Vec<Str
|
|||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
fn restore(
|
|
||||||
param: Value,
|
|
||||||
_info: &ApiMethod,
|
|
||||||
_rpcenv: &mut dyn RpcEnvironment,
|
|
||||||
) -> Result<Value, Error> {
|
|
||||||
async_main(restore_do(param))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn dump_image<W: Write>(
|
fn dump_image<W: Write>(
|
||||||
client: Arc<BackupReader>,
|
client: Arc<BackupReader>,
|
||||||
crypt_config: Option<Arc<CryptConfig>>,
|
crypt_config: Option<Arc<CryptConfig>>,
|
||||||
@ -944,6 +984,17 @@ fn dump_image<W: Write>(
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn restore<'a>(
|
||||||
|
param: Value,
|
||||||
|
_info: &ApiMethod,
|
||||||
|
_rpcenv: &'a mut dyn RpcEnvironment,
|
||||||
|
) -> ApiFuture<'a> {
|
||||||
|
|
||||||
|
async move {
|
||||||
|
restore_do(param).await
|
||||||
|
}.boxed()
|
||||||
|
}
|
||||||
|
|
||||||
async fn restore_do(param: Value) -> Result<Value, Error> {
|
async fn restore_do(param: Value) -> Result<Value, Error> {
|
||||||
let repo = extract_repository_from_value(¶m)?;
|
let repo = extract_repository_from_value(¶m)?;
|
||||||
|
|
||||||
@ -1103,11 +1154,17 @@ async fn restore_do(param: Value) -> Result<Value, Error> {
|
|||||||
Ok(Value::Null)
|
Ok(Value::Null)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn upload_log(
|
fn upload_log<'a>(
|
||||||
param: Value,
|
param: Value,
|
||||||
_info: &ApiMethod,
|
_info: &ApiMethod,
|
||||||
_rpcenv: &mut dyn RpcEnvironment,
|
_rpcenv: &'a mut dyn RpcEnvironment,
|
||||||
) -> Result<Value, Error> {
|
) -> ApiFuture<'a> {
|
||||||
|
async move {
|
||||||
|
upload_log_async(param).await
|
||||||
|
}.boxed()
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn upload_log_async(param: Value) -> Result<Value, Error> {
|
||||||
|
|
||||||
let logfile = tools::required_string_param(¶m, "logfile")?;
|
let logfile = tools::required_string_param(¶m, "logfile")?;
|
||||||
let repo = extract_repository_from_value(¶m)?;
|
let repo = extract_repository_from_value(¶m)?;
|
||||||
@ -1144,9 +1201,7 @@ fn upload_log(
|
|||||||
|
|
||||||
let body = hyper::Body::from(raw_data);
|
let body = hyper::Body::from(raw_data);
|
||||||
|
|
||||||
async_main(async move {
|
|
||||||
client.upload("application/octet-stream", body, &path, Some(args)).await
|
client.upload("application/octet-stream", body, &path, Some(args)).await
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prune(
|
fn prune(
|
||||||
@ -1791,12 +1846,15 @@ async fn mount_do(param: Value, pipe: Option<RawFd>) -> Result<Value, Error> {
|
|||||||
Ok(Value::Null)
|
Ok(Value::Null)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn catalog_shell(
|
fn catalog_shell<'a>(
|
||||||
param: Value,
|
param: Value,
|
||||||
_info: &ApiMethod,
|
_info: &ApiMethod,
|
||||||
_rpcenv: &mut dyn RpcEnvironment,
|
_rpcenv: &'a mut dyn RpcEnvironment,
|
||||||
) -> Result<Value, Error> {
|
) -> ApiFuture<'a> {
|
||||||
async_main(catalog_shell_async(param))
|
|
||||||
|
async move {
|
||||||
|
catalog_shell_async(param).await
|
||||||
|
}.boxed()
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn catalog_shell_async(param: Value) -> Result<Value, Error> {
|
async fn catalog_shell_async(param: Value) -> Result<Value, Error> {
|
||||||
@ -1910,7 +1968,7 @@ fn catalog_mgmt_cli() -> CliCommandMap {
|
|||||||
|
|
||||||
#[sortable]
|
#[sortable]
|
||||||
const API_METHOD_SHELL: ApiMethod = ApiMethod::new(
|
const API_METHOD_SHELL: ApiMethod = ApiMethod::new(
|
||||||
&ApiHandler::Sync(&catalog_shell),
|
&ApiHandler::Async(&catalog_shell),
|
||||||
&ObjectSchema::new(
|
&ObjectSchema::new(
|
||||||
"Shell to interactively inspect and restore snapshots.",
|
"Shell to interactively inspect and restore snapshots.",
|
||||||
&sorted!([
|
&sorted!([
|
||||||
@ -1930,7 +1988,7 @@ fn catalog_mgmt_cli() -> CliCommandMap {
|
|||||||
|
|
||||||
#[sortable]
|
#[sortable]
|
||||||
const API_METHOD_DUMP_CATALOG: ApiMethod = ApiMethod::new(
|
const API_METHOD_DUMP_CATALOG: ApiMethod = ApiMethod::new(
|
||||||
&ApiHandler::Sync(&dump_catalog),
|
&ApiHandler::Async(&dump_catalog),
|
||||||
&ObjectSchema::new(
|
&ObjectSchema::new(
|
||||||
"Dump catalog.",
|
"Dump catalog.",
|
||||||
&sorted!([
|
&sorted!([
|
||||||
@ -2097,7 +2155,7 @@ fn main() {
|
|||||||
|
|
||||||
#[sortable]
|
#[sortable]
|
||||||
const API_METHOD_CREATE_BACKUP: ApiMethod = ApiMethod::new(
|
const API_METHOD_CREATE_BACKUP: ApiMethod = ApiMethod::new(
|
||||||
&ApiHandler::Sync(&create_backup),
|
&ApiHandler::Async(&create_backup),
|
||||||
&ObjectSchema::new(
|
&ObjectSchema::new(
|
||||||
"Create (host) backup.",
|
"Create (host) backup.",
|
||||||
&sorted!([
|
&sorted!([
|
||||||
@ -2178,7 +2236,7 @@ fn main() {
|
|||||||
|
|
||||||
#[sortable]
|
#[sortable]
|
||||||
const API_METHOD_UPLOAD_LOG: ApiMethod = ApiMethod::new(
|
const API_METHOD_UPLOAD_LOG: ApiMethod = ApiMethod::new(
|
||||||
&ApiHandler::Sync(&upload_log),
|
&ApiHandler::Async(&upload_log),
|
||||||
&ObjectSchema::new(
|
&ObjectSchema::new(
|
||||||
"Upload backup log file.",
|
"Upload backup log file.",
|
||||||
&sorted!([
|
&sorted!([
|
||||||
@ -2215,7 +2273,7 @@ fn main() {
|
|||||||
|
|
||||||
#[sortable]
|
#[sortable]
|
||||||
const API_METHOD_LIST_BACKUP_GROUPS: ApiMethod = ApiMethod::new(
|
const API_METHOD_LIST_BACKUP_GROUPS: ApiMethod = ApiMethod::new(
|
||||||
&ApiHandler::Sync(&list_backup_groups),
|
&ApiHandler::Async(&list_backup_groups),
|
||||||
&ObjectSchema::new(
|
&ObjectSchema::new(
|
||||||
"List backup groups.",
|
"List backup groups.",
|
||||||
&sorted!([
|
&sorted!([
|
||||||
@ -2230,7 +2288,7 @@ fn main() {
|
|||||||
|
|
||||||
#[sortable]
|
#[sortable]
|
||||||
const API_METHOD_LIST_SNAPSHOTS: ApiMethod = ApiMethod::new(
|
const API_METHOD_LIST_SNAPSHOTS: ApiMethod = ApiMethod::new(
|
||||||
&ApiHandler::Sync(&list_snapshots),
|
&ApiHandler::Async(&list_snapshots),
|
||||||
&ObjectSchema::new(
|
&ObjectSchema::new(
|
||||||
"List backup snapshots.",
|
"List backup snapshots.",
|
||||||
&sorted!([
|
&sorted!([
|
||||||
@ -2248,7 +2306,7 @@ fn main() {
|
|||||||
|
|
||||||
#[sortable]
|
#[sortable]
|
||||||
const API_METHOD_FORGET_SNAPSHOTS: ApiMethod = ApiMethod::new(
|
const API_METHOD_FORGET_SNAPSHOTS: ApiMethod = ApiMethod::new(
|
||||||
&ApiHandler::Sync(&forget_snapshots),
|
&ApiHandler::Async(&forget_snapshots),
|
||||||
&ObjectSchema::new(
|
&ObjectSchema::new(
|
||||||
"Forget (remove) backup snapshots.",
|
"Forget (remove) backup snapshots.",
|
||||||
&sorted!([
|
&sorted!([
|
||||||
@ -2265,7 +2323,7 @@ fn main() {
|
|||||||
|
|
||||||
#[sortable]
|
#[sortable]
|
||||||
const API_METHOD_START_GARBAGE_COLLECTION: ApiMethod = ApiMethod::new(
|
const API_METHOD_START_GARBAGE_COLLECTION: ApiMethod = ApiMethod::new(
|
||||||
&ApiHandler::Sync(&start_garbage_collection),
|
&ApiHandler::Async(&start_garbage_collection),
|
||||||
&ObjectSchema::new(
|
&ObjectSchema::new(
|
||||||
"Start garbage collection for a specific repository.",
|
"Start garbage collection for a specific repository.",
|
||||||
&sorted!([ ("repository", true, &REPO_URL_SCHEMA) ]),
|
&sorted!([ ("repository", true, &REPO_URL_SCHEMA) ]),
|
||||||
@ -2277,7 +2335,7 @@ fn main() {
|
|||||||
|
|
||||||
#[sortable]
|
#[sortable]
|
||||||
const API_METHOD_RESTORE: ApiMethod = ApiMethod::new(
|
const API_METHOD_RESTORE: ApiMethod = ApiMethod::new(
|
||||||
&ApiHandler::Sync(&restore),
|
&ApiHandler::Async(&restore),
|
||||||
&ObjectSchema::new(
|
&ObjectSchema::new(
|
||||||
"Restore backup repository.",
|
"Restore backup repository.",
|
||||||
&sorted!([
|
&sorted!([
|
||||||
@ -2323,7 +2381,7 @@ We do not extraxt '.pxar' archives when writing to stdandard output.
|
|||||||
|
|
||||||
#[sortable]
|
#[sortable]
|
||||||
const API_METHOD_LIST_SNAPSHOT_FILES: ApiMethod = ApiMethod::new(
|
const API_METHOD_LIST_SNAPSHOT_FILES: ApiMethod = ApiMethod::new(
|
||||||
&ApiHandler::Sync(&list_snapshot_files),
|
&ApiHandler::Async(&list_snapshot_files),
|
||||||
&ObjectSchema::new(
|
&ObjectSchema::new(
|
||||||
"List snapshot files.",
|
"List snapshot files.",
|
||||||
&sorted!([
|
&sorted!([
|
||||||
@ -2377,7 +2435,7 @@ We do not extraxt '.pxar' archives when writing to stdandard output.
|
|||||||
|
|
||||||
#[sortable]
|
#[sortable]
|
||||||
const API_METHOD_API_LOGIN: ApiMethod = ApiMethod::new(
|
const API_METHOD_API_LOGIN: ApiMethod = ApiMethod::new(
|
||||||
&ApiHandler::Sync(&api_login),
|
&ApiHandler::Async(&api_login),
|
||||||
&ObjectSchema::new(
|
&ObjectSchema::new(
|
||||||
"Try to login. If successful, store ticket.",
|
"Try to login. If successful, store ticket.",
|
||||||
&sorted!([ ("repository", true, &REPO_URL_SCHEMA) ]),
|
&sorted!([ ("repository", true, &REPO_URL_SCHEMA) ]),
|
||||||
|
Loading…
Reference in New Issue
Block a user