diff options
author | Alex Auvolat <alex@adnab.me> | 2024-02-05 19:27:12 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2024-02-05 19:27:12 +0100 |
commit | a22bd319202f05bce4ad13072238c7ba81d518fb (patch) | |
tree | 817d90efaeaa51ea8aebaf5b25ad56c8b968dc0c /src/api/admin | |
parent | 0bb5b77530ad432e4c77f13b395fe74613812337 (diff) | |
download | garage-a22bd319202f05bce4ad13072238c7ba81d518fb.tar.gz garage-a22bd319202f05bce4ad13072238c7ba81d518fb.zip |
[dep-upgrade-202402] migration to http/hyper 1.0 for k2v api
Diffstat (limited to 'src/api/admin')
-rw-r--r-- | src/api/admin/bucket.rs | 6 | ||||
-rw-r--r-- | src/api/admin/cluster.rs | 8 | ||||
-rw-r--r-- | src/api/admin/error.rs | 12 | ||||
-rw-r--r-- | src/api/admin/key.rs | 6 |
4 files changed, 10 insertions, 22 deletions
diff --git a/src/api/admin/bucket.rs b/src/api/admin/bucket.rs index 0bfb87c5..1b22dd03 100644 --- a/src/api/admin/bucket.rs +++ b/src/api/admin/bucket.rs @@ -271,7 +271,7 @@ pub async fn handle_create_bucket( garage: &Arc<Garage>, req: Request<IncomingBody>, ) -> Result<Response<ResBody>, Error> { - let req = parse_json_body::<CreateBucketRequest>(req).await?; + let req = parse_json_body::<CreateBucketRequest, _, Error>(req).await?; if let Some(ga) = &req.global_alias { if !is_valid_bucket_name(ga) { @@ -412,7 +412,7 @@ pub async fn handle_update_bucket( id: String, req: Request<IncomingBody>, ) -> Result<Response<ResBody>, Error> { - let req = parse_json_body::<UpdateBucketRequest>(req).await?; + let req = parse_json_body::<UpdateBucketRequest, _, Error>(req).await?; let bucket_id = parse_bucket_id(&id)?; let mut bucket = garage @@ -474,7 +474,7 @@ pub async fn handle_bucket_change_key_perm( req: Request<IncomingBody>, new_perm_flag: bool, ) -> Result<Response<ResBody>, Error> { - let req = parse_json_body::<BucketKeyPermChangeRequest>(req).await?; + let req = parse_json_body::<BucketKeyPermChangeRequest, _, Error>(req).await?; let bucket_id = parse_bucket_id(&req.bucket_id)?; diff --git a/src/api/admin/cluster.rs b/src/api/admin/cluster.rs index 1ec8d6de..3876c608 100644 --- a/src/api/admin/cluster.rs +++ b/src/api/admin/cluster.rs @@ -64,7 +64,7 @@ pub async fn handle_connect_cluster_nodes( garage: &Arc<Garage>, req: Request<IncomingBody>, ) -> Result<Response<ResBody>, Error> { - let req = parse_json_body::<Vec<String>>(req).await?; + let req = parse_json_body::<Vec<String>, _, Error>(req).await?; let res = futures::future::join_all(req.iter().map(|node| garage.system.connect(node))) .await @@ -206,7 +206,7 @@ pub async fn handle_update_cluster_layout( garage: &Arc<Garage>, req: Request<IncomingBody>, ) -> Result<Response<ResBody>, Error> { - let updates = parse_json_body::<UpdateClusterLayoutRequest>(req).await?; + let updates = parse_json_body::<UpdateClusterLayoutRequest, _, Error>(req).await?; let mut layout = garage.system.get_cluster_layout(); @@ -246,7 +246,7 @@ pub async fn handle_apply_cluster_layout( garage: &Arc<Garage>, req: Request<IncomingBody>, ) -> Result<Response<ResBody>, Error> { - let param = parse_json_body::<ApplyRevertLayoutRequest>(req).await?; + let param = parse_json_body::<ApplyRevertLayoutRequest, _, Error>(req).await?; let layout = garage.system.get_cluster_layout(); let (layout, msg) = layout.apply_staged_changes(Some(param.version))?; @@ -264,7 +264,7 @@ pub async fn handle_revert_cluster_layout( garage: &Arc<Garage>, req: Request<IncomingBody>, ) -> Result<Response<ResBody>, Error> { - let param = parse_json_body::<ApplyRevertLayoutRequest>(req).await?; + let param = parse_json_body::<ApplyRevertLayoutRequest, _, Error>(req).await?; let layout = garage.system.get_cluster_layout(); let layout = layout.revert_staged_changes(Some(param.version))?; diff --git a/src/api/admin/error.rs b/src/api/admin/error.rs index 98cc7a9e..011c903f 100644 --- a/src/api/admin/error.rs +++ b/src/api/admin/error.rs @@ -40,18 +40,6 @@ where impl CommonErrorDerivative for Error {} -impl From<HelperError> for Error { - fn from(err: HelperError) -> Self { - match err { - HelperError::Internal(i) => Self::Common(CommonError::InternalError(i)), - HelperError::BadRequest(b) => Self::Common(CommonError::BadRequest(b)), - HelperError::InvalidBucketName(n) => Self::Common(CommonError::InvalidBucketName(n)), - HelperError::NoSuchBucket(n) => Self::Common(CommonError::NoSuchBucket(n)), - HelperError::NoSuchAccessKey(n) => Self::NoSuchAccessKey(n), - } - } -} - impl Error { fn code(&self) -> &'static str { match self { diff --git a/src/api/admin/key.rs b/src/api/admin/key.rs index 3e5d2cab..1efaca16 100644 --- a/src/api/admin/key.rs +++ b/src/api/admin/key.rs @@ -65,7 +65,7 @@ pub async fn handle_create_key( garage: &Arc<Garage>, req: Request<IncomingBody>, ) -> Result<Response<ResBody>, Error> { - let req = parse_json_body::<CreateKeyRequest>(req).await?; + let req = parse_json_body::<CreateKeyRequest, _, Error>(req).await?; let key = Key::new(req.name.as_deref().unwrap_or("Unnamed key")); garage.key_table.insert(&key).await?; @@ -83,7 +83,7 @@ pub async fn handle_import_key( garage: &Arc<Garage>, req: Request<IncomingBody>, ) -> Result<Response<ResBody>, Error> { - let req = parse_json_body::<ImportKeyRequest>(req).await?; + let req = parse_json_body::<ImportKeyRequest, _, Error>(req).await?; let prev_key = garage.key_table.get(&EmptyKey, &req.access_key_id).await?; if prev_key.is_some() { @@ -114,7 +114,7 @@ pub async fn handle_update_key( id: String, req: Request<IncomingBody>, ) -> Result<Response<ResBody>, Error> { - let req = parse_json_body::<UpdateKeyRequest>(req).await?; + let req = parse_json_body::<UpdateKeyRequest, _, Error>(req).await?; let mut key = garage.key_helper().get_existing_key(&id).await?; |