From e4b0723aa3aae286d8392b902027e76e3324602a Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Fri, 14 Feb 2025 13:21:10 +0100 Subject: [PATCH] rename Condition into RedirectCondition in internal model --- src/api/s3/website.rs | 12 +++++++----- src/model/bucket_table.rs | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/api/s3/website.rs b/src/api/s3/website.rs index 18384932..0f2e7d34 100644 --- a/src/api/s3/website.rs +++ b/src/api/s3/website.rs @@ -246,9 +246,11 @@ impl WebsiteConfiguration { .into_iter() .map(|rule| { bucket_table::RoutingRule { - condition: rule.condition.map(|condition| bucket_table::Condition { - http_error_code: condition.http_error_code.map(|c| c.0 as u16), - prefix: condition.prefix.map(|p| p.0), + condition: rule.condition.map(|condition| { + bucket_table::RedirectCondition { + http_error_code: condition.http_error_code.map(|c| c.0 as u16), + prefix: condition.prefix.map(|p| p.0), + } }), redirect: bucket_table::Redirect { hostname: rule.redirect.hostname.map(|h| h.0), @@ -435,7 +437,7 @@ mod tests { routing_rules: RoutingRules { rules: vec![ RoutingRule { - condition: Some(Condition { + condition: Some(RedirectCondition { http_error_code: Some(IntValue(404)), prefix: Some(Value("prefix1".to_owned())), }), @@ -448,7 +450,7 @@ mod tests { }, }, RoutingRule { - condition: Some(Condition { + condition: Some(RedirectCondition { http_error_code: None, prefix: Some(Value("".to_owned())), }), diff --git a/src/model/bucket_table.rs b/src/model/bucket_table.rs index c4d247d7..7317c36f 100644 --- a/src/model/bucket_table.rs +++ b/src/model/bucket_table.rs @@ -185,12 +185,12 @@ mod v2 { #[derive(PartialEq, Eq, Clone, Debug, Serialize, Deserialize)] pub struct RoutingRule { - pub condition: Option, + pub condition: Option, pub redirect: Redirect, } #[derive(PartialEq, Eq, Clone, Debug, Serialize, Deserialize)] - pub struct Condition { + pub struct RedirectCondition { pub http_error_code: Option, pub prefix: Option, }