diff options
author | Alex Auvolat <lx@deuxfleurs.fr> | 2025-01-30 13:36:25 +0100 |
---|---|---|
committer | Alex Auvolat <lx@deuxfleurs.fr> | 2025-01-30 13:36:25 +0100 |
commit | f37d5d2b08b008eba7b1ee8d84b08d5fddeabf78 (patch) | |
tree | 453085c608fc35687f5207bffc2fc5a007d918e2 /src/api/admin/bucket.rs | |
parent | 819f4f00509a57097d0ee8291e1556829e982e14 (diff) | |
download | garage-f37d5d2b08b008eba7b1ee8d84b08d5fddeabf78.tar.gz garage-f37d5d2b08b008eba7b1ee8d84b08d5fddeabf78.zip |
admin api: convert most bucket operations
Diffstat (limited to 'src/api/admin/bucket.rs')
-rw-r--r-- | src/api/admin/bucket.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/api/admin/bucket.rs b/src/api/admin/bucket.rs index 0cc420ec..d2d75fc0 100644 --- a/src/api/admin/bucket.rs +++ b/src/api/admin/bucket.rs @@ -73,16 +73,22 @@ impl EndpointHandler for GetBucketInfoRequest { type Response = GetBucketInfoResponse; async fn handle(self, garage: &Arc<Garage>) -> Result<GetBucketInfoResponse, Error> { - let bucket_id = match (self.id, self.global_alias) { - (Some(id), None) => parse_bucket_id(&id)?, - (None, Some(ga)) => garage + let bucket_id = match (self.id, self.global_alias, self.search) { + (Some(id), None, None) => parse_bucket_id(&id)?, + (None, Some(ga), None) => garage .bucket_helper() .resolve_global_bucket_name(&ga) .await? .ok_or_else(|| HelperError::NoSuchBucket(ga.to_string()))?, + (None, None, Some(search)) => { + garage + .bucket_helper() + .admin_get_existing_matching_bucket(&search) + .await? + } _ => { return Err(Error::bad_request( - "Either id or globalAlias must be provided (but not both)", + "Either id, globalAlias or search must be provided (but not several of them)", )); } }; |