Skip to main content

rc_core/admin/
site.rs

1//! Service control and site replication admin types.
2//!
3//! Wire formats mirror the RustFS server's `crates/madmin` definitions
4//! (MinIO-admin-compatible JSON field names).
5
6use serde::{Deserialize, Serialize};
7
8/// A peer site definition for `site-replication/add`.
9///
10/// Field names follow the MinIO admin wire format (note: the endpoint
11/// serializes as `endpoints`).
12#[derive(Debug, Clone, Serialize, Deserialize, Default)]
13pub struct PeerSiteSpec {
14    #[serde(default)]
15    pub name: String,
16    #[serde(rename = "endpoints", default)]
17    pub endpoint: String,
18    #[serde(rename = "accessKey", default)]
19    pub access_key: String,
20    #[serde(rename = "secretKey", default)]
21    pub secret_key: String,
22    #[serde(rename = "skipTlsVerify", default)]
23    pub skip_tls_verify: bool,
24    #[serde(
25        rename = "caCertPem",
26        default,
27        skip_serializing_if = "String::is_empty"
28    )]
29    pub ca_cert_pem: String,
30}
31
32/// Response from `POST /service?action=...`.
33#[derive(Debug, Clone, Serialize, Deserialize, Default)]
34pub struct ServiceActionResult {
35    #[serde(default)]
36    pub action: String,
37    #[serde(default)]
38    pub accepted: bool,
39    /// Whether the action takes real effect on this build (vs advisory only).
40    #[serde(default)]
41    pub effective: bool,
42    #[serde(default)]
43    pub message: String,
44}
45
46/// Options for `site-replication/status`.
47#[derive(Debug, Clone, Default)]
48pub struct SiteStatusOptions {
49    pub buckets: bool,
50    pub users: bool,
51    pub groups: bool,
52    pub policies: bool,
53    pub metrics: bool,
54    pub peer_state: bool,
55    pub ilm_expiry_rules: bool,
56}
57
58/// Request body for `site-replication/remove`.
59#[derive(Debug, Clone, Serialize, Deserialize, Default)]
60pub struct SiteRemoveSpec {
61    #[serde(rename = "sites", default, skip_serializing_if = "Vec::is_empty")]
62    pub site_names: Vec<String>,
63    #[serde(rename = "all", default)]
64    pub remove_all: bool,
65}