aboutsummaryrefslogtreecommitdiff
path: root/src/api/s3_list.rs
diff options
context:
space:
mode:
authortrinity-1686a <trinity.pointard@gmail.com>2021-12-06 15:17:47 +0100
committerAlex <alex@adnab.me>2021-12-06 15:17:47 +0100
commitc4ac8835d388b14e144b01599c0f1351bdb9e958 (patch)
treee2bdb8e9ef34ea01c13ee126728f7adac2642e6a /src/api/s3_list.rs
parentccce75bc25a2827e23443ec65ceb6b409f4a55ae (diff)
downloadgarage-c4ac8835d388b14e144b01599c0f1351bdb9e958.tar.gz
garage-c4ac8835d388b14e144b01599c0f1351bdb9e958.zip
add proper request router for s3 api (#163)
fix #161 Current request router was organically grown, and is getting messier and messier with each addition. This router cover exaustively existing API endpoints (with exceptions listed in [#161(comment)](https://git.deuxfleurs.fr/Deuxfleurs/garage/issues/161#issuecomment-1773) either because new and old api endpoint can't feasabily be differentied, or it's more lambda than s3). Co-authored-by: Trinity Pointard <trinity.pointard@gmail.com> Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/163 Reviewed-by: Alex <alex@adnab.me> Co-authored-by: trinity-1686a <trinity.pointard@gmail.com> Co-committed-by: trinity-1686a <trinity.pointard@gmail.com>
Diffstat (limited to 'src/api/s3_list.rs')
-rw-r--r--src/api/s3_list.rs28
1 files changed, 1 insertions, 27 deletions
diff --git a/src/api/s3_list.rs b/src/api/s3_list.rs
index a4de388d..df9c3e6b 100644
--- a/src/api/s3_list.rs
+++ b/src/api/s3_list.rs
@@ -1,4 +1,4 @@
-use std::collections::{BTreeMap, BTreeSet, HashMap};
+use std::collections::{BTreeMap, BTreeSet};
use std::sync::Arc;
use hyper::{Body, Response};
@@ -35,32 +35,6 @@ struct ListResultInfo {
etag: String,
}
-pub fn parse_list_objects_query(
- bucket: &str,
- params: &HashMap<String, String>,
-) -> Result<ListObjectsQuery, Error> {
- Ok(ListObjectsQuery {
- is_v2: params.get("list-type").map(|x| x == "2").unwrap_or(false),
- bucket: bucket.to_string(),
- delimiter: params.get("delimiter").filter(|x| !x.is_empty()).cloned(),
- max_keys: params
- .get("max-keys")
- .map(|x| {
- x.parse::<usize>()
- .ok_or_bad_request("Invalid value for max-keys")
- })
- .unwrap_or(Ok(1000))?,
- prefix: params.get("prefix").cloned().unwrap_or_default(),
- marker: params.get("marker").cloned(),
- continuation_token: params.get("continuation-token").cloned(),
- start_after: params.get("start-after").cloned(),
- urlencode_resp: params
- .get("encoding-type")
- .map(|x| x == "url")
- .unwrap_or(false),
- })
-}
-
pub async fn handle_list(
garage: Arc<Garage>,
query: &ListObjectsQuery,