move src/server/rest.rs to proxmox-rest-server crate

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Dietmar Maurer 2021-09-21 07:58:51 +02:00 committed by Thomas Lamprecht
parent 36b7085ec2
commit 6fbf0acc76
8 changed files with 14 additions and 14 deletions

View File

@ -16,9 +16,13 @@ libc = "0.2"
log = "0.4" log = "0.4"
nix = "0.19.1" nix = "0.19.1"
percent-encoding = "2.1" percent-encoding = "2.1"
regex = "1.2"
serde = { version = "1.0", features = [] } serde = { version = "1.0", features = [] }
serde_json = "1.0" serde_json = "1.0"
tokio = { version = "1.6", features = ["signal", "process"] } tokio = { version = "1.6", features = ["signal", "process"] }
tokio-openssl = "0.6.1"
tower-service = "0.3.0"
url = "2.1"
proxmox = { version = "0.13.3", features = [ "router"] } proxmox = { version = "0.13.3", features = [ "router"] }

View File

@ -26,6 +26,9 @@ pub use file_logger::{FileLogger, FileLogOptions};
mod api_config; mod api_config;
pub use api_config::ApiConfig; pub use api_config::ApiConfig;
mod rest;
pub use rest::{RestServer, handle_api_request};
pub enum AuthError { pub enum AuthError {
Generic(Error), Generic(Error),
NoData, NoData,

View File

@ -32,11 +32,11 @@ use proxmox::http_err;
use pbs_tools::compression::{DeflateEncoder, Level}; use pbs_tools::compression::{DeflateEncoder, Level};
use pbs_tools::stream::AsyncReaderStream; use pbs_tools::stream::AsyncReaderStream;
use proxmox_rest_server::{
use crate::{
ApiConfig, FileLogger, AuthError, RestEnvironment, CompressionMethod, ApiConfig, FileLogger, AuthError, RestEnvironment, CompressionMethod,
extract_cookie, normalize_uri_path, extract_cookie, normalize_uri_path, formatter::*,
}; };
use proxmox_rest_server::formatter::*;
extern "C" { extern "C" {
fn tzset(); fn tzset();

View File

@ -10,12 +10,11 @@ use proxmox::api::RpcEnvironmentType;
use proxmox::tools::fs::CreateOptions; use proxmox::tools::fs::CreateOptions;
use pbs_tools::auth::private_auth_key; use pbs_tools::auth::private_auth_key;
use proxmox_rest_server::ApiConfig; use proxmox_rest_server::{ApiConfig, RestServer};
use proxmox_backup::server::{ use proxmox_backup::server::{
self, self,
auth::default_api_auth, auth::default_api_auth,
rest::*,
}; };
use proxmox_rest_server::daemon; use proxmox_rest_server::daemon;

View File

@ -19,14 +19,13 @@ use proxmox::api::RpcEnvironmentType;
use proxmox::sys::linux::socket::set_tcp_keepalive; use proxmox::sys::linux::socket::set_tcp_keepalive;
use proxmox::tools::fs::CreateOptions; use proxmox::tools::fs::CreateOptions;
use proxmox_rest_server::ApiConfig; use proxmox_rest_server::{ApiConfig, RestServer};
use proxmox_backup::{ use proxmox_backup::{
backup::DataStore, backup::DataStore,
server::{ server::{
auth::default_api_auth, auth::default_api_auth,
WorkerTask, WorkerTask,
rest::*,
jobstate::{ jobstate::{
self, self,
Job, Job,

View File

@ -21,9 +21,7 @@ use hyper::header;
use proxmox::api::RpcEnvironmentType; use proxmox::api::RpcEnvironmentType;
use pbs_client::DEFAULT_VSOCK_PORT; use pbs_client::DEFAULT_VSOCK_PORT;
use proxmox_rest_server::ApiConfig; use proxmox_rest_server::{ApiConfig, RestServer};
use proxmox_backup::server::rest::*;
mod proxmox_restore_daemon; mod proxmox_restore_daemon;
use proxmox_restore_daemon::*; use proxmox_restore_daemon::*;

View File

@ -61,7 +61,7 @@ impl <E: RpcEnvironment + Clone> H2Service<E> {
future::ok((formatter.format_error)(err)).boxed() future::ok((formatter.format_error)(err)).boxed()
} }
Some(api_method) => { Some(api_method) => {
crate::server::rest::handle_api_request( proxmox_rest_server::handle_api_request(
self.rpcenv.clone(), api_method, formatter, parts, body, uri_param).boxed() self.rpcenv.clone(), api_method, formatter, parts, body, uri_param).boxed()
} }
} }

View File

@ -55,9 +55,6 @@ pub use worker_task::*;
mod h2service; mod h2service;
pub use h2service::*; pub use h2service::*;
#[macro_use]
pub mod rest;
pub mod jobstate; pub mod jobstate;
mod verify_job; mod verify_job;