mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-22 04:16:38 +00:00
init bucketmeta struct
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::time::Duration;
|
||||
use time::OffsetDateTime;
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Deserialize, Serialize, Default)]
|
||||
pub struct Credentials {
|
||||
access_key: String,
|
||||
secret_key: String,
|
||||
@@ -8,93 +10,70 @@ pub struct Credentials {
|
||||
expiration: Option<OffsetDateTime>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Deserialize, Serialize, Default)]
|
||||
pub enum ServiceType {
|
||||
#[default]
|
||||
Replication,
|
||||
}
|
||||
|
||||
// pub struct LatencyStat {
|
||||
// curr: Duration, // 当前延迟
|
||||
// avg: Duration, // 平均延迟
|
||||
// max: Duration, // 最大延迟
|
||||
// }
|
||||
#[derive(Debug, Deserialize, Serialize, Default)]
|
||||
pub struct LatencyStat {
|
||||
curr: Duration, // 当前延迟
|
||||
avg: Duration, // 平均延迟
|
||||
max: Duration, // 最大延迟
|
||||
}
|
||||
|
||||
// #[derive(Serialize, Deserialize, Debug)]
|
||||
// pub struct LatencyStat {
|
||||
// curr: Duration,
|
||||
// avg: Duration,
|
||||
// max: Duration,
|
||||
// }
|
||||
// 定义BucketTarget结构体
|
||||
#[derive(Debug, Deserialize, Serialize, Default)]
|
||||
pub struct BucketTarget {
|
||||
source_bucket: String,
|
||||
|
||||
// // 定义BucketTarget结构体
|
||||
// #[derive(Serialize, Deserialize, Debug)]
|
||||
// pub struct BucketTarget {
|
||||
// #[serde(rename = "sourcebucket")]
|
||||
// source_bucket: String,
|
||||
endpoint: String,
|
||||
|
||||
// #[serde(rename = "endpoint")]
|
||||
// endpoint: String,
|
||||
credentials: Option<Credentials>,
|
||||
|
||||
// #[serde(rename = "credentials")]
|
||||
// credentials: Option<Credentials>,
|
||||
target_bucket: String,
|
||||
|
||||
// #[serde(rename = "targetbucket")]
|
||||
// target_bucket: String,
|
||||
secure: bool,
|
||||
|
||||
// #[serde(rename = "secure")]
|
||||
// secure: bool,
|
||||
path: Option<String>,
|
||||
|
||||
// #[serde(rename = "path", skip_serializing_if = "Option::is_none")]
|
||||
// path: Option<String>,
|
||||
api: Option<String>,
|
||||
|
||||
// #[serde(rename = "api", skip_serializing_if = "Option::is_none")]
|
||||
// api: Option<String>,
|
||||
arn: Option<String>,
|
||||
|
||||
// #[serde(rename = "arn", skip_serializing_if = "Option::is_none")]
|
||||
// arn: Option<String>,
|
||||
type_: ServiceType,
|
||||
|
||||
// #[serde(rename = "type")]
|
||||
// type_: ServiceType,
|
||||
region: Option<String>,
|
||||
|
||||
// #[serde(rename = "region", skip_serializing_if = "Option::is_none")]
|
||||
// region: Option<String>,
|
||||
bandwidth_limit: Option<i64>,
|
||||
|
||||
// #[serde(rename = "bandwidthlimit")]
|
||||
// bandwidth_limit: Option<i64>,
|
||||
replication_sync: bool,
|
||||
|
||||
// #[serde(rename = "replicationSync")]
|
||||
// replication_sync: bool,
|
||||
storage_class: Option<String>,
|
||||
|
||||
// #[serde(rename = "storageclass", skip_serializing_if = "Option::is_none")]
|
||||
// storage_class: Option<String>,
|
||||
health_check_duration: Option<Duration>,
|
||||
|
||||
// #[serde(rename = "healthCheckDuration")]
|
||||
// health_check_duration: Option<Duration>,
|
||||
disable_proxy: bool,
|
||||
|
||||
// #[serde(rename = "disableProxy")]
|
||||
// disable_proxy: bool,
|
||||
reset_before_date: Option<OffsetDateTime>,
|
||||
|
||||
// #[serde(rename = "resetBeforeDate", skip_serializing_if = "Option::is_none")]
|
||||
// reset_before_date: Option<SystemTime>,
|
||||
reset_id: Option<String>,
|
||||
|
||||
// #[serde(rename = "resetID", skip_serializing_if = "Option::is_none")]
|
||||
// reset_id: Option<String>,
|
||||
total_downtime: Duration,
|
||||
|
||||
// #[serde(rename = "totalDowntime")]
|
||||
// total_downtime: Duration,
|
||||
last_online: Option<OffsetDateTime>,
|
||||
|
||||
// #[serde(rename = "lastOnline")]
|
||||
// last_online: SystemTime,
|
||||
online: bool,
|
||||
|
||||
// #[serde(rename = "isOnline")]
|
||||
// online: bool,
|
||||
latency: LatencyStat,
|
||||
|
||||
// #[serde(rename = "latency")]
|
||||
// latency: LatencyStat,
|
||||
deployment_id: Option<String>,
|
||||
|
||||
// #[serde(rename = "deploymentID", skip_serializing_if = "Option::is_none")]
|
||||
// deployment_id: Option<String>,
|
||||
edge: bool,
|
||||
}
|
||||
|
||||
// #[serde(rename = "edge")]
|
||||
// edge: bool,
|
||||
// }
|
||||
#[derive(Debug, Deserialize, Serialize, Default)]
|
||||
pub struct BucketTargets {
|
||||
pub targets: Vec<BucketTarget>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user