diff options
Diffstat (limited to 'src/api/admin/router.rs')
-rw-r--r-- | src/api/admin/router.rs | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/src/api/admin/router.rs b/src/api/admin/router.rs index 0225f18b..254aff12 100644 --- a/src/api/admin/router.rs +++ b/src/api/admin/router.rs @@ -35,6 +35,7 @@ pub enum Endpoint { GetKeyInfo { id: Option<String>, search: Option<String>, + show_secret_key: Option<String>, }, DeleteKey { id: String, @@ -95,37 +96,37 @@ impl Endpoint { GET "/check" => CheckDomain, GET "/health" => Health, GET "/metrics" => Metrics, - GET "/v0/status" => GetClusterStatus, - GET "/v0/health" => GetClusterHealth, - POST "/v0/connect" => ConnectClusterNodes, + GET "/v1/status" => GetClusterStatus, + GET "/v1/health" => GetClusterHealth, + POST ("/v0/connect" | "/v1/connect") => ConnectClusterNodes, // Layout endpoints - GET "/v0/layout" => GetClusterLayout, - POST "/v0/layout" => UpdateClusterLayout, - POST "/v0/layout/apply" => ApplyClusterLayout, - POST "/v0/layout/revert" => RevertClusterLayout, + GET "/v1/layout" => GetClusterLayout, + POST "/v1/layout" => UpdateClusterLayout, + POST "/v1/layout/apply" => ApplyClusterLayout, + POST ("/v0/layout/revert" | "/v1/layout/revert") => RevertClusterLayout, // API key endpoints - GET "/v0/key" if id => GetKeyInfo (query_opt::id, query_opt::search), - GET "/v0/key" if search => GetKeyInfo (query_opt::id, query_opt::search), - POST "/v0/key" if id => UpdateKey (query::id), - POST "/v0/key" => CreateKey, - POST "/v0/key/import" => ImportKey, - DELETE "/v0/key" if id => DeleteKey (query::id), - GET "/v0/key" => ListKeys, + GET "/v1/key" if id => GetKeyInfo (query_opt::id, query_opt::search, query_opt::show_secret_key), + GET "/v1/key" if search => GetKeyInfo (query_opt::id, query_opt::search, query_opt::show_secret_key), + POST "/v1/key" if id => UpdateKey (query::id), + POST "/v1/key" => CreateKey, + POST "/v1/key/import" => ImportKey, + DELETE ("/v0/key" | "/v1/key") if id => DeleteKey (query::id), + GET ("/v0/key" | "/v1/key") => ListKeys, // Bucket endpoints - GET "/v0/bucket" if id => GetBucketInfo (query_opt::id, query_opt::global_alias), - GET "/v0/bucket" if global_alias => GetBucketInfo (query_opt::id, query_opt::global_alias), - GET "/v0/bucket" => ListBuckets, - POST "/v0/bucket" => CreateBucket, - DELETE "/v0/bucket" if id => DeleteBucket (query::id), - PUT "/v0/bucket" if id => UpdateBucket (query::id), + GET ("/v0/bucket" | "/v1/bucket") if id => GetBucketInfo (query_opt::id, query_opt::global_alias), + GET ("/v0/bucket" | "/v1/bucket") if global_alias => GetBucketInfo (query_opt::id, query_opt::global_alias), + GET ("/v0/bucket" | "/v1/bucket") => ListBuckets, + POST ("/v0/bucket" | "/v1/bucket") => CreateBucket, + DELETE ("/v0/bucket" | "/v1/bucket") if id => DeleteBucket (query::id), + PUT ("/v0/bucket" | "/v1/bucket") if id => UpdateBucket (query::id), // Bucket-key permissions - POST "/v0/bucket/allow" => BucketAllowKey, - POST "/v0/bucket/deny" => BucketDenyKey, + POST ("/v0/bucket/allow" | "/v1/bucket/allow") => BucketAllowKey, + POST ("/v0/bucket/deny" | "/v1/bucket/deny") => BucketDenyKey, // Bucket aliases - PUT "/v0/bucket/alias/global" => GlobalAliasBucket (query::id, query::alias), - DELETE "/v0/bucket/alias/global" => GlobalUnaliasBucket (query::id, query::alias), - PUT "/v0/bucket/alias/local" => LocalAliasBucket (query::id, query::access_key_id, query::alias), - DELETE "/v0/bucket/alias/local" => LocalUnaliasBucket (query::id, query::access_key_id, query::alias), + PUT ("/v0/bucket/alias/global" | "/v1/bucket/alias/global") => GlobalAliasBucket (query::id, query::alias), + DELETE ("/v0/bucket/alias/global" | "/v1/bucket/alias/global") => GlobalUnaliasBucket (query::id, query::alias), + PUT ("/v0/bucket/alias/local" | "/v1/bucket/alias/local") => LocalAliasBucket (query::id, query::access_key_id, query::alias), + DELETE ("/v0/bucket/alias/local" | "/v1/bucket/alias/local") => LocalUnaliasBucket (query::id, query::access_key_id, query::alias), ]); if let Some(message) = query.nonempty_message() { @@ -153,6 +154,7 @@ generateQueryParameters! { "search" => search, "globalAlias" => global_alias, "alias" => alias, - "accessKeyId" => access_key_id + "accessKeyId" => access_key_id, + "showSecretKey" => show_secret_key ] } |