From 28cc9f178a1368e53143aab663577b0ffbf50b35 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Wed, 14 Jun 2023 13:56:37 +0200 Subject: admin api: make name optionnal for CreateKey --- src/api/admin/key.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/api/admin') diff --git a/src/api/admin/key.rs b/src/api/admin/key.rs index 25ba76f8..664fde4c 100644 --- a/src/api/admin/key.rs +++ b/src/api/admin/key.rs @@ -65,7 +65,7 @@ pub async fn handle_create_key( ) -> Result, Error> { let req = parse_json_body::(req).await?; - let key = Key::new(&req.name); + let key = Key::new(req.name.as_deref().unwrap_or("Unnamed key")); garage.key_table.insert(&key).await?; key_info_results(garage, key).await @@ -74,7 +74,7 @@ pub async fn handle_create_key( #[derive(Deserialize)] #[serde(rename_all = "camelCase")] struct CreateKeyRequest { - name: String, + name: Option, } pub async fn handle_import_key( -- cgit v1.2.3