pub struct PathMapping {
pub bucket_segments: usize,
pub bucket_separator: String,
pub display_bucket_segments: usize,
}Expand description
Defines how URL path segments map to internal bucket names.
Fields§
§bucket_segments: usizeNumber of path segments that form the “bucket” portion.
E.g., 2 for /{account}/{product}/...
bucket_separator: StringSeparator to join segments into an internal bucket name.
E.g., “:” produces account:product.
display_bucket_segments: usizeHow many leading segments form the “display bucket” name for XML responses.
E.g., 1 means <Name> shows just account.
Implementations§
Source§impl PathMapping
impl PathMapping
Sourcepub fn parse(&self, path: &str) -> Option<MappedPath>
pub fn parse(&self, path: &str) -> Option<MappedPath>
Parse a URL path into a MappedPath.
The path is expected to start with /. Segments are split on /,
and the first bucket_segments segments form the internal bucket name.
Any remaining content becomes the key.
Returns None if there are fewer than bucket_segments non-empty segments.
Sourcepub fn parse_bucket_name(&self, bucket_name: &str) -> Option<MappedPath>
pub fn parse_bucket_name(&self, bucket_name: &str) -> Option<MappedPath>
Parse a bucket name (e.g., “account:product”) back into a MappedPath.
Used by MappedRegistry when it receives an already-mapped bucket name.
Returns None if the bucket name does not split into exactly bucket_segments parts.
Sourcepub fn rewrite_request(&self, path: &str, query: Option<&str>) -> RewriteResult
pub fn rewrite_request(&self, path: &str, query: Option<&str>) -> RewriteResult
Rewrite an incoming request path and query string for the gateway.
Translates hierarchical paths into internal single-segment bucket paths:
-
Path-based: if the path has enough segments, they are joined into a single bucket name.
/{a}/{b}/{key}→/{a:b}/{key} -
Prefix-based: if the path has fewer segments than required but the query string contains a
list-type=param with a non-emptyprefix=, the first component of the prefix is folded into the bucket name./{a}?list-type=2&prefix=b/sub/→/{a:b}?list-type=2&prefix=sub/ -
Pass-through: all other paths are returned unchanged. Route handlers or the gateway itself will handle them.
Sourcepub fn rewrite_copy_source(&self, copy_source: &str) -> Option<String>
pub fn rewrite_copy_source(&self, copy_source: &str) -> Option<String>
Rewrite an x-amz-copy-source header value into the gateway’s bucket
namespace.
CopyObject names its source in a header rather than the URL, so
rewrite_request never sees it and the gateway
would otherwise resolve a client-facing name (alukach) that the
registry has never heard of. Feed the result to
RequestInfo::with_copy_source alongside the untouched header, which
stays as sent for SigV4 verification.
/{a}/{b}/{key}[?versionId=id] → /{a:b}/{key}[?versionId=id]. The key
keeps its percent-encoding (only leading segments are rewritten), and
the versionId suffix rides through. Returns None when the value has
too few segments to map, leaving the caller to pass the header through
unchanged.
Trait Implementations§
Source§impl Clone for PathMapping
impl Clone for PathMapping
Source§fn clone(&self) -> PathMapping
fn clone(&self) -> PathMapping
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for PathMapping
impl RefUnwindSafe for PathMapping
impl Send for PathMapping
impl Sync for PathMapping
impl Unpin for PathMapping
impl UnsafeUnpin for PathMapping
impl UnwindSafe for PathMapping
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more