diff --git a/src/server/formatter.rs b/proxmox-rest-server/src/formatter.rs similarity index 100% rename from src/server/formatter.rs rename to proxmox-rest-server/src/formatter.rs diff --git a/proxmox-rest-server/src/lib.rs b/proxmox-rest-server/src/lib.rs index 42e78d89..bc8334ba 100644 --- a/proxmox-rest-server/src/lib.rs +++ b/proxmox-rest-server/src/lib.rs @@ -5,6 +5,7 @@ use anyhow::{bail, format_err, Error}; use proxmox::tools::fd::Fd; pub mod daemon; +pub mod formatter; mod environment; pub use environment::*; diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs index dc1c0ae9..20aca6fb 100644 --- a/src/api2/admin/datastore.rs +++ b/src/api2/admin/datastore.rs @@ -54,6 +54,7 @@ use pbs_tools::blocking::WrappedReaderStream; use pbs_tools::stream::{AsyncReaderStream, AsyncChannelWriter}; use pbs_tools::json::{required_integer_param, required_string_param}; use pbs_config::CachedUserInfo; +use proxmox_rest_server::formatter; use crate::api2::node::rrd::create_value_from_rrd; use crate::backup::{ @@ -1326,7 +1327,7 @@ pub fn upload_backup_log( replace_file(&path, blob.raw_data(), CreateOptions::new())?; // fixme: use correct formatter - Ok(crate::server::formatter::json_response(Ok(Value::Null))) + Ok(formatter::json_response(Ok(Value::Null))) }.boxed() } diff --git a/src/api2/backup/environment.rs b/src/api2/backup/environment.rs index 1766639e..129ebd2b 100644 --- a/src/api2/backup/environment.rs +++ b/src/api2/backup/environment.rs @@ -15,10 +15,10 @@ use pbs_datastore::backup_info::{BackupDir, BackupInfo}; use pbs_datastore::dynamic_index::DynamicIndexWriter; use pbs_datastore::fixed_index::FixedIndexWriter; use pbs_api_types::Authid; +use proxmox_rest_server::formatter::*; use crate::backup::{verify_backup_dir_with_lock, DataStore}; use crate::server::WorkerTask; -use crate::server::formatter::*; use hyper::{Body, Response}; #[derive(Copy, Clone, Serialize)] diff --git a/src/api2/reader/environment.rs b/src/api2/reader/environment.rs index 64a01c4d..f7d79072 100644 --- a/src/api2/reader/environment.rs +++ b/src/api2/reader/environment.rs @@ -7,9 +7,9 @@ use proxmox::api::{RpcEnvironment, RpcEnvironmentType}; use pbs_datastore::backup_info::BackupDir; use pbs_api_types::Authid; +use proxmox_rest_server::formatter::*; use crate::backup::DataStore; -use crate::server::formatter::*; use crate::server::WorkerTask; //use proxmox::tools; diff --git a/src/server/h2service.rs b/src/server/h2service.rs index 332b3b1a..a79387c0 100644 --- a/src/server/h2service.rs +++ b/src/server/h2service.rs @@ -11,8 +11,9 @@ use hyper::{Body, Request, Response, StatusCode}; use proxmox::api::{ApiResponseFuture, HttpError, Router, RpcEnvironment}; use proxmox::http_err; +use proxmox_rest_server::formatter::*; + use crate::tools; -use crate::server::formatter::*; use crate::server::WorkerTask; /// Hyper Service implementation to handle stateful H2 connections. diff --git a/src/server/mod.rs b/src/server/mod.rs index c426383f..1fc57575 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -55,8 +55,6 @@ pub use worker_task::*; mod h2service; pub use h2service::*; -pub mod formatter; - #[macro_use] pub mod rest; diff --git a/src/server/rest.rs b/src/server/rest.rs index 6af6fa55..8beecb55 100644 --- a/src/server/rest.rs +++ b/src/server/rest.rs @@ -35,8 +35,7 @@ use pbs_tools::compression::{DeflateEncoder, Level}; use pbs_tools::stream::AsyncReaderStream; use pbs_api_types::{Authid, Userid}; use proxmox_rest_server::{ApiConfig, FileLogger, FileLogOptions, AuthError, RestEnvironment}; - -use super::formatter::*; +use proxmox_rest_server::formatter::*; use crate::auth_helpers::*; use pbs_config::CachedUserInfo;