aboutsummaryrefslogtreecommitdiff
path: root/src/garage
diff options
context:
space:
mode:
authorAlex <alex@adnab.me>2024-03-19 16:17:16 +0000
committerAlex <alex@adnab.me>2024-03-19 16:17:16 +0000
commit26310f3242319c9ad093f5121cff0fe0c0108542 (patch)
tree4821890dc5f4d5aa98d25242d04abd494a5d9ab4 /src/garage
parent693b89b94b05608c241551447ba0a83aac68c705 (diff)
parent783b586de93ffa210d6c34fd7cc266220a57a4d2 (diff)
downloadgarage-26310f3242319c9ad093f5121cff0fe0c0108542.tar.gz
garage-26310f3242319c9ad093f5121cff0fe0c0108542.zip
Merge pull request 'CLI: allow manipulating buckets by prefixes of their full IDs' (#783) from bucket-id-prefix into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/783
Diffstat (limited to 'src/garage')
-rw-r--r--src/garage/admin/bucket.rs40
1 files changed, 16 insertions, 24 deletions
diff --git a/src/garage/admin/bucket.rs b/src/garage/admin/bucket.rs
index 803b55bd..ac43e122 100644
--- a/src/garage/admin/bucket.rs
+++ b/src/garage/admin/bucket.rs
@@ -54,9 +54,8 @@ impl AdminRpcHandler {
let bucket_id = self
.garage
.bucket_helper()
- .resolve_global_bucket_name(&query.name)
- .await?
- .ok_or_bad_request("Bucket not found")?;
+ .admin_get_existing_matching_bucket(&query.name)
+ .await?;
let bucket = self
.garage
@@ -157,9 +156,8 @@ impl AdminRpcHandler {
let bucket_id = helper
.bucket()
- .resolve_global_bucket_name(&query.name)
- .await?
- .ok_or_bad_request("Bucket not found")?;
+ .admin_get_existing_matching_bucket(&query.name)
+ .await?;
// Get the alias, but keep in minde here the bucket name
// given in parameter can also be directly the bucket's ID.
@@ -235,9 +233,8 @@ impl AdminRpcHandler {
let bucket_id = helper
.bucket()
- .resolve_global_bucket_name(&query.existing_bucket)
- .await?
- .ok_or_bad_request("Bucket not found")?;
+ .admin_get_existing_matching_bucket(&query.existing_bucket)
+ .await?;
if let Some(key_pattern) = &query.local {
let key = helper.key().get_existing_matching_key(key_pattern).await?;
@@ -307,9 +304,8 @@ impl AdminRpcHandler {
let bucket_id = helper
.bucket()
- .resolve_global_bucket_name(&query.bucket)
- .await?
- .ok_or_bad_request("Bucket not found")?;
+ .admin_get_existing_matching_bucket(&query.bucket)
+ .await?;
let key = helper
.key()
.get_existing_matching_key(&query.key_pattern)
@@ -343,9 +339,8 @@ impl AdminRpcHandler {
let bucket_id = helper
.bucket()
- .resolve_global_bucket_name(&query.bucket)
- .await?
- .ok_or_bad_request("Bucket not found")?;
+ .admin_get_existing_matching_bucket(&query.bucket)
+ .await?;
let key = helper
.key()
.get_existing_matching_key(&query.key_pattern)
@@ -378,9 +373,8 @@ impl AdminRpcHandler {
let bucket_id = self
.garage
.bucket_helper()
- .resolve_global_bucket_name(&query.bucket)
- .await?
- .ok_or_bad_request("Bucket not found")?;
+ .admin_get_existing_matching_bucket(&query.bucket)
+ .await?;
let mut bucket = self
.garage
@@ -420,9 +414,8 @@ impl AdminRpcHandler {
let bucket_id = self
.garage
.bucket_helper()
- .resolve_global_bucket_name(&query.bucket)
- .await?
- .ok_or_bad_request("Bucket not found")?;
+ .admin_get_existing_matching_bucket(&query.bucket)
+ .await?;
let mut bucket = self
.garage
@@ -479,9 +472,8 @@ impl AdminRpcHandler {
bucket_ids.push(
self.garage
.bucket_helper()
- .resolve_global_bucket_name(b)
- .await?
- .ok_or_bad_request(format!("Bucket not found: {}", b))?,
+ .admin_get_existing_matching_bucket(b)
+ .await?,
);
}