admin API: add missing camelCase conversions (fix #381)

This commit is contained in:
Alex Auvolat 2023-06-13 16:15:50 +02:00
parent 7126f3e1d1
commit bf19a44fd9
2 changed files with 7 additions and 0 deletions

View File

@ -114,6 +114,7 @@ struct GetClusterStatusResponse {
} }
#[derive(Serialize)] #[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct ConnectClusterNodesResponse { struct ConnectClusterNodesResponse {
success: bool, success: bool,
error: Option<String>, error: Option<String>,
@ -128,6 +129,7 @@ struct GetClusterLayoutResponse {
} }
#[derive(Serialize)] #[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct KnownNodeResp { struct KnownNodeResp {
addr: SocketAddr, addr: SocketAddr,
is_up: bool, is_up: bool,
@ -197,6 +199,7 @@ pub async fn handle_revert_cluster_layout(
type UpdateClusterLayoutRequest = HashMap<String, Option<NodeRole>>; type UpdateClusterLayoutRequest = HashMap<String, Option<NodeRole>>;
#[derive(Deserialize)] #[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
struct ApplyRevertLayoutRequest { struct ApplyRevertLayoutRequest {
version: u64, version: u64,
} }

View File

@ -34,6 +34,7 @@ pub async fn handle_list_keys(garage: &Arc<Garage>) -> Result<Response<Body>, Er
} }
#[derive(Serialize)] #[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct ListKeyResultItem { struct ListKeyResultItem {
id: String, id: String,
name: String, name: String,
@ -71,6 +72,7 @@ pub async fn handle_create_key(
} }
#[derive(Deserialize)] #[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
struct CreateKeyRequest { struct CreateKeyRequest {
name: String, name: String,
} }
@ -131,6 +133,7 @@ pub async fn handle_update_key(
} }
#[derive(Deserialize)] #[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
struct UpdateKeyRequest { struct UpdateKeyRequest {
name: Option<String>, name: Option<String>,
allow: Option<KeyPerm>, allow: Option<KeyPerm>,
@ -246,6 +249,7 @@ struct KeyInfoBucketResult {
} }
#[derive(Serialize, Deserialize, Default)] #[derive(Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub(crate) struct ApiBucketKeyPerm { pub(crate) struct ApiBucketKeyPerm {
#[serde(default)] #[serde(default)]
pub(crate) read: bool, pub(crate) read: bool,