more api type cleanups: avoid re-exports
This commit is contained in:
@ -29,6 +29,7 @@ use pxar::EntryKind;
|
||||
use pbs_api_types::{ Authid, BackupContent, Counts, CryptMode,
|
||||
DataStoreListItem, GarbageCollectionStatus, GroupListItem,
|
||||
SnapshotListItem, SnapshotVerifyState, PruneOptions,
|
||||
DataStoreStatus, RRDMode, RRDTimeFrameResolution,
|
||||
BACKUP_ARCHIVE_NAME_SCHEMA, BACKUP_ID_SCHEMA, BACKUP_TIME_SCHEMA,
|
||||
BACKUP_TYPE_SCHEMA, DATASTORE_SCHEMA,
|
||||
IGNORE_VERIFIED_BACKUPS_SCHEMA, UPID_SCHEMA,
|
||||
@ -54,7 +55,6 @@ use pbs_tools::stream::{AsyncReaderStream, AsyncChannelWriter};
|
||||
use pbs_tools::json::{required_integer_param, required_string_param};
|
||||
use pbs_config::CachedUserInfo;
|
||||
|
||||
use crate::api2::types::{DataStoreStatus, RRDMode, RRDTimeFrameResolution};
|
||||
use crate::api2::node::rrd::create_value_from_rrd;
|
||||
use crate::backup::{
|
||||
check_backup_owner, verify_all_backups, verify_backup_group, verify_backup_dir, verify_filter,
|
||||
|
@ -9,15 +9,12 @@ use proxmox::api::{api, ApiMethod, Permission, Router, RpcEnvironment};
|
||||
|
||||
use pbs_api_types::{
|
||||
VerificationJobConfig, VerificationJobStatus, JOB_ID_SCHEMA, Authid,
|
||||
PRIV_DATASTORE_AUDIT, PRIV_DATASTORE_VERIFY,
|
||||
PRIV_DATASTORE_AUDIT, PRIV_DATASTORE_VERIFY, DATASTORE_SCHEMA,
|
||||
};
|
||||
use pbs_config::verify;
|
||||
use pbs_config::CachedUserInfo;
|
||||
|
||||
use crate::{
|
||||
api2::types::{
|
||||
DATASTORE_SCHEMA,
|
||||
},
|
||||
server::{
|
||||
do_verification_job,
|
||||
jobstate::{
|
||||
|
@ -14,8 +14,8 @@ use pbs_datastore::DataBlob;
|
||||
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 crate::api2::types::Authid;
|
||||
use crate::backup::{verify_backup_dir_with_lock, DataStore};
|
||||
use crate::server::WorkerTask;
|
||||
use crate::server::formatter::*;
|
||||
|
@ -15,7 +15,7 @@ use proxmox::api::schema::*;
|
||||
use pbs_api_types::{
|
||||
Authid, VerifyState, SnapshotVerifyState,
|
||||
BACKUP_ID_SCHEMA, BACKUP_TIME_SCHEMA, BACKUP_TYPE_SCHEMA, DATASTORE_SCHEMA,
|
||||
CHUNK_DIGEST_SCHEMA, PRIV_DATASTORE_BACKUP,
|
||||
CHUNK_DIGEST_SCHEMA, PRIV_DATASTORE_BACKUP, BACKUP_ARCHIVE_NAME_SCHEMA,
|
||||
};
|
||||
use pbs_tools::fs::lock_dir_noblock_shared;
|
||||
use pbs_tools::json::{required_array_param, required_integer_param, required_string_param};
|
||||
@ -340,7 +340,7 @@ pub const API_METHOD_CREATE_DYNAMIC_INDEX: ApiMethod = ApiMethod::new(
|
||||
&ObjectSchema::new(
|
||||
"Create dynamic chunk index file.",
|
||||
&sorted!([
|
||||
("archive-name", false, &crate::api2::types::BACKUP_ARCHIVE_NAME_SCHEMA),
|
||||
("archive-name", false, &BACKUP_ARCHIVE_NAME_SCHEMA),
|
||||
]),
|
||||
)
|
||||
);
|
||||
@ -377,7 +377,7 @@ pub const API_METHOD_CREATE_FIXED_INDEX: ApiMethod = ApiMethod::new(
|
||||
&ObjectSchema::new(
|
||||
"Create fixed chunk index file.",
|
||||
&sorted!([
|
||||
("archive-name", false, &crate::api2::types::BACKUP_ARCHIVE_NAME_SCHEMA),
|
||||
("archive-name", false, &BACKUP_ARCHIVE_NAME_SCHEMA),
|
||||
("size", false, &IntegerSchema::new("File size.")
|
||||
.minimum(1)
|
||||
.schema()
|
||||
@ -735,7 +735,7 @@ pub const API_METHOD_DOWNLOAD_PREVIOUS: ApiMethod = ApiMethod::new(
|
||||
&ObjectSchema::new(
|
||||
"Download archive from previous backup.",
|
||||
&sorted!([
|
||||
("archive-name", false, &crate::api2::types::BACKUP_ARCHIVE_NAME_SCHEMA)
|
||||
("archive-name", false, &BACKUP_ARCHIVE_NAME_SCHEMA)
|
||||
]),
|
||||
)
|
||||
);
|
||||
|
@ -15,8 +15,8 @@ use proxmox::api::schema::*;
|
||||
use pbs_datastore::DataBlob;
|
||||
use pbs_datastore::file_formats::{DataBlobHeader, EncryptedDataBlobHeader};
|
||||
use pbs_tools::json::{required_integer_param, required_string_param};
|
||||
use pbs_api_types::{CHUNK_DIGEST_SCHEMA, BACKUP_ARCHIVE_NAME_SCHEMA};
|
||||
|
||||
use crate::api2::types::*;
|
||||
use crate::backup::DataStore;
|
||||
|
||||
use super::environment::*;
|
||||
@ -247,7 +247,7 @@ pub const API_METHOD_UPLOAD_BLOB: ApiMethod = ApiMethod::new(
|
||||
&ObjectSchema::new(
|
||||
"Upload binary blob file.",
|
||||
&sorted!([
|
||||
("file-name", false, &crate::api2::types::BACKUP_ARCHIVE_NAME_SCHEMA),
|
||||
("file-name", false, &BACKUP_ARCHIVE_NAME_SCHEMA),
|
||||
("encoded-size", false, &IntegerSchema::new("Encoded blob size.")
|
||||
.minimum(std::mem::size_of::<DataBlobHeader>() as isize)
|
||||
.maximum(1024*1024*16+(std::mem::size_of::<EncryptedDataBlobHeader>() as isize))
|
||||
|
@ -3,10 +3,11 @@
|
||||
|
||||
use anyhow::Error;
|
||||
|
||||
use crate::api2::types::PROXMOX_CONFIG_DIGEST_SCHEMA;
|
||||
use proxmox::api::{api, Permission, Router, RpcEnvironment, SubdirMap};
|
||||
use proxmox::list_subdirs_api_method;
|
||||
|
||||
use pbs_api_types::PROXMOX_CONFIG_DIGEST_SCHEMA;
|
||||
|
||||
use crate::config::tfa::{self, WebauthnConfig, WebauthnConfigUpdater};
|
||||
|
||||
pub const ROUTER: Router = Router::new()
|
||||
|
@ -9,15 +9,14 @@ use proxmox::api::router::SubdirMap;
|
||||
use proxmox::{identity, list_subdirs_api_method, sortable};
|
||||
|
||||
use pbs_api_types::{
|
||||
Userid, Authid, Tokenname, TaskListItem,
|
||||
Userid, Authid, Tokenname, TaskListItem, TaskStateType, UPID,
|
||||
NODE_SCHEMA, UPID_SCHEMA, VERIFICATION_JOB_WORKER_ID_REGEX,
|
||||
SYNC_JOB_WORKER_ID_REGEX, DATASTORE_SCHEMA,
|
||||
PRIV_DATASTORE_MODIFY, PRIV_DATASTORE_VERIFY, PRIV_SYS_AUDIT, PRIV_SYS_MODIFY,
|
||||
};
|
||||
|
||||
use crate::api2::types::TaskStateType;
|
||||
use crate::api2::pull::check_pull_privs;
|
||||
use crate::server::{self, UPID, UPIDExt, TaskState, TaskListInfoIterator};
|
||||
use crate::server::{self, UPIDExt, TaskState, TaskListInfoIterator};
|
||||
use pbs_config::CachedUserInfo;
|
||||
|
||||
// matches respective job execution privileges
|
||||
|
@ -6,8 +6,8 @@ use serde_json::{json, Value};
|
||||
use proxmox::api::{RpcEnvironment, RpcEnvironmentType};
|
||||
|
||||
use pbs_datastore::backup_info::BackupDir;
|
||||
use pbs_api_types::Authid;
|
||||
|
||||
use crate::api2::types::Authid;
|
||||
use crate::backup::DataStore;
|
||||
use crate::server::formatter::*;
|
||||
use crate::server::WorkerTask;
|
||||
|
@ -30,6 +30,7 @@ use proxmox::{
|
||||
use pbs_api_types::{
|
||||
Authid, DATASTORE_SCHEMA, BACKUP_TYPE_SCHEMA, BACKUP_TIME_SCHEMA, BACKUP_ID_SCHEMA,
|
||||
CHUNK_DIGEST_SCHEMA, PRIV_DATASTORE_READ, PRIV_DATASTORE_BACKUP,
|
||||
BACKUP_ARCHIVE_NAME_SCHEMA,
|
||||
};
|
||||
use pbs_tools::fs::lock_dir_noblock_shared;
|
||||
use pbs_tools::json::{required_integer_param, required_string_param};
|
||||
@ -223,7 +224,7 @@ pub const API_METHOD_DOWNLOAD_FILE: ApiMethod = ApiMethod::new(
|
||||
&ObjectSchema::new(
|
||||
"Download specified file.",
|
||||
&sorted!([
|
||||
("file-name", false, &crate::api2::types::BACKUP_ARCHIVE_NAME_SCHEMA),
|
||||
("file-name", false, &BACKUP_ARCHIVE_NAME_SCHEMA),
|
||||
]),
|
||||
)
|
||||
);
|
||||
|
@ -12,8 +12,9 @@ use proxmox::{
|
||||
list_subdirs_api_method,
|
||||
};
|
||||
|
||||
use pbs_api_types::TapeDeviceInfo;
|
||||
|
||||
use crate::{
|
||||
api2::types::TapeDeviceInfo,
|
||||
tape::{
|
||||
lto_tape_device_list,
|
||||
linux_tape_changer_list,
|
||||
|
@ -3,7 +3,7 @@ use serde_json::Value;
|
||||
|
||||
use proxmox::api::{api, schema::{ApiType, Schema, StringSchema, ApiStringFormat}};
|
||||
|
||||
use crate::api2::types::{
|
||||
use pbs_api_types::{
|
||||
DNS_ALIAS_FORMAT, DNS_NAME_FORMAT, PROXMOX_SAFE_ID_FORMAT,
|
||||
};
|
||||
|
||||
|
@ -5,11 +5,11 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
use proxmox::api::{api, schema::*};
|
||||
|
||||
use pbs_api_types::StorageStatus;
|
||||
|
||||
mod acme;
|
||||
pub use acme::*;
|
||||
|
||||
pub use pbs_api_types::*;
|
||||
|
||||
// File names: may not contain slashes, may not start with "."
|
||||
pub const FILENAME_FORMAT: ApiStringFormat = ApiStringFormat::VerifyFn(|name| {
|
||||
if name.starts_with('.') {
|
||||
@ -24,49 +24,6 @@ pub const FILENAME_FORMAT: ApiStringFormat = ApiStringFormat::VerifyFn(|name| {
|
||||
|
||||
// Complex type definitions
|
||||
|
||||
#[api(
|
||||
properties: {
|
||||
"gc-status": {
|
||||
type: GarbageCollectionStatus,
|
||||
optional: true,
|
||||
},
|
||||
counts: {
|
||||
type: Counts,
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
)]
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[serde(rename_all="kebab-case")]
|
||||
/// Overall Datastore status and useful information.
|
||||
pub struct DataStoreStatus {
|
||||
/// Total space (bytes).
|
||||
pub total: u64,
|
||||
/// Used space (bytes).
|
||||
pub used: u64,
|
||||
/// Available space (bytes).
|
||||
pub avail: u64,
|
||||
/// Status of last GC
|
||||
#[serde(skip_serializing_if="Option::is_none")]
|
||||
pub gc_status: Option<GarbageCollectionStatus>,
|
||||
/// Group/Snapshot counts
|
||||
#[serde(skip_serializing_if="Option::is_none")]
|
||||
pub counts: Option<Counts>,
|
||||
}
|
||||
|
||||
#[api()]
|
||||
#[derive(Eq, PartialEq, Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum TaskStateType {
|
||||
/// Ok
|
||||
OK,
|
||||
/// Warning
|
||||
Warning,
|
||||
/// Error
|
||||
Error,
|
||||
/// Unknown
|
||||
Unknown,
|
||||
}
|
||||
|
||||
// Regression tests
|
||||
|
||||
|
Reference in New Issue
Block a user