mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-27 23:47:28 +00:00
refactor(admin): modularize handlers and route registration (#1787)
This commit is contained in:
@@ -18,7 +18,7 @@ Or simply run `make pre-commit` which covers all checks. **DO NOT commit if any
|
|||||||
|
|
||||||
## Communication Rules
|
## Communication Rules
|
||||||
|
|
||||||
- Respond to the user in English.
|
- Respond to the user in the same language used by the user.
|
||||||
- Code and documentation must be written in English only.
|
- Code and documentation must be written in English only.
|
||||||
- **Pull Request titles and descriptions must be written in English** to ensure consistency and accessibility for all contributors.
|
- **Pull Request titles and descriptions must be written in English** to ensure consistency and accessibility for all contributors.
|
||||||
|
|
||||||
|
|||||||
+23
-1
@@ -240,6 +240,14 @@ pub fn make_admin_route(console_enabled: bool) -> std::io::Result<impl S3Route>
|
|||||||
AdminOperation(&bucket_meta::ImportBucketMetadata {}),
|
AdminOperation(&bucket_meta::ImportBucketMetadata {}),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
register_replication_route(&mut r)?;
|
||||||
|
register_profiling_route(&mut r)?;
|
||||||
|
register_kms_route(&mut r)?;
|
||||||
|
|
||||||
|
Ok(r)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn register_replication_route(r: &mut S3Router<AdminOperation>) -> std::io::Result<()> {
|
||||||
r.insert(
|
r.insert(
|
||||||
Method::GET,
|
Method::GET,
|
||||||
format!("{}{}", ADMIN_PREFIX, "/v3/list-remote-targets").as_str(),
|
format!("{}{}", ADMIN_PREFIX, "/v3/list-remote-targets").as_str(),
|
||||||
@@ -264,6 +272,10 @@ pub fn make_admin_route(console_enabled: bool) -> std::io::Result<impl S3Route>
|
|||||||
AdminOperation(&RemoveRemoteTargetHandler {}),
|
AdminOperation(&RemoveRemoteTargetHandler {}),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn register_profiling_route(r: &mut S3Router<AdminOperation>) -> std::io::Result<()> {
|
||||||
// Performance profiling endpoints (available on all platforms, with platform-specific responses)
|
// Performance profiling endpoints (available on all platforms, with platform-specific responses)
|
||||||
r.insert(
|
r.insert(
|
||||||
Method::GET,
|
Method::GET,
|
||||||
@@ -277,6 +289,10 @@ pub fn make_admin_route(console_enabled: bool) -> std::io::Result<impl S3Route>
|
|||||||
AdminOperation(&handlers::ProfileStatusHandler {}),
|
AdminOperation(&handlers::ProfileStatusHandler {}),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn register_kms_route(r: &mut S3Router<AdminOperation>) -> std::io::Result<()> {
|
||||||
// KMS management endpoints
|
// KMS management endpoints
|
||||||
r.insert(
|
r.insert(
|
||||||
Method::POST,
|
Method::POST,
|
||||||
@@ -382,7 +398,7 @@ pub fn make_admin_route(console_enabled: bool) -> std::io::Result<impl S3Route>
|
|||||||
AdminOperation(&kms_keys::DescribeKmsKeyHandler {}),
|
AdminOperation(&kms_keys::DescribeKmsKeyHandler {}),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
Ok(r)
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// user router
|
/// user router
|
||||||
@@ -537,6 +553,12 @@ fn register_user_route(r: &mut S3Router<AdminOperation>) -> std::io::Result<()>
|
|||||||
AdminOperation(&policies::SetPolicyForUserOrGroup {}),
|
AdminOperation(&policies::SetPolicyForUserOrGroup {}),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
register_notification_target_route(r)?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn register_notification_target_route(r: &mut S3Router<AdminOperation>) -> std::io::Result<()> {
|
||||||
r.insert(
|
r.insert(
|
||||||
Method::GET,
|
Method::GET,
|
||||||
format!("{}{}", ADMIN_PREFIX, "/v3/target/list").as_str(),
|
format!("{}{}", ADMIN_PREFIX, "/v3/target/list").as_str(),
|
||||||
|
|||||||
Reference in New Issue
Block a user