aboutsummaryrefslogtreecommitdiff
path: root/src/garage/cli/util.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2021-12-15 18:36:15 +0100
committerAlex Auvolat <alex@adnab.me>2022-01-04 12:45:51 +0100
commit53f71b3a57b3c1828292e26b7865d31e9bec44d6 (patch)
treeb874fa38a3680b7ba153d34a711f4ebff6884c00 /src/garage/cli/util.rs
parent5b1117e582db16cc5aa50840a685875cbd5501f4 (diff)
downloadgarage-53f71b3a57b3c1828292e26b7865d31e9bec44d6.tar.gz
garage-53f71b3a57b3c1828292e26b7865d31e9bec44d6.zip
Implement bucket alias and bucket unalias
Diffstat (limited to 'src/garage/cli/util.rs')
-rw-r--r--src/garage/cli/util.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/garage/cli/util.rs b/src/garage/cli/util.rs
index be34183e..ba88502d 100644
--- a/src/garage/cli/util.rs
+++ b/src/garage/cli/util.rs
@@ -12,17 +12,22 @@ pub fn print_key_info(key: &Key) {
match &key.state {
Deletable::Present(p) => {
println!("\nKey-specific bucket aliases:");
+ let mut table = vec![];
for (alias_name, _, alias) in p.local_aliases.items().iter() {
if let Some(bucket_id) = alias.as_option() {
- println!("- {} {:?}", alias_name, bucket_id);
+ table.push(format!("\t{}\t{}", alias_name, hex::encode(bucket_id)));
}
}
+ format_table(table);
+
println!("\nAuthorized buckets:");
+ let mut table = vec![];
for (b, perm) in p.authorized_buckets.items().iter() {
let rflag = if perm.allow_read { "R" } else { " " };
let wflag = if perm.allow_write { "W" } else { " " };
- println!("- {}{} {:?}", rflag, wflag, b);
+ table.push(format!("\t{}{}\t{:?}", rflag, wflag, b));
}
+ format_table(table);
}
Deletable::Deleted => {
println!("\nKey is deleted.");
@@ -41,12 +46,14 @@ pub fn print_bucket_info(bucket: &Bucket) {
println!("- {}", alias);
}
}
+
println!("\nKey-specific aliases:");
for ((key_id, alias), _, active) in p.local_aliases.items().iter() {
if *active {
println!("- {} {}", key_id, alias);
}
}
+
println!("\nAuthorized keys:");
for (k, perm) in p.authorized_keys.items().iter() {
let rflag = if perm.allow_read { "R" } else { " " };