pub struct Location { /* private fields */ }s3 only.Expand description
The place of a bucket repository: its address, the region of the signature, the endpoint, and the addressing style.
Location::new applies these rules:
- With no endpoint, the endpoint is AWS:
https://s3.REGION.amazonaws.com. - An endpoint is an
http://or anhttps://URL with no path, no query, no fragment, and no userinfo. One trailing/is allowed. - Path style puts the bucket in the path:
ENDPOINT/BUCKET/PREFIX/.... Virtual-host style puts the bucket in the host:https://BUCKET.HOST/PREFIX/.... - The default style is virtual-host for AWS, and path for an endpoint of
the caller. A bucket name that holds a
.gets path style by default. A style that the caller sets wins. - Virtual-host style is refused for a bucket name that holds a
.overhttps, because the certificate of the endpoint does not match such a host. It is also refused for an endpoint whose host is an IP address.
An http:// endpoint needs
allow_cleartext_credentials
in the options of the bucket client, because the signature is a
credential.
Implementations§
Source§impl Location
impl Location
Sourcepub fn new(
address: Address,
region: &str,
endpoint: Option<&str>,
addressing: Option<Addressing>,
) -> Result<Location>
pub fn new( address: Address, region: &str, endpoint: Option<&str>, addressing: Option<Addressing>, ) -> Result<Location>
Returns the location of address with the region region, the
endpoint endpoint, and the addressing style addressing.
None for endpoint is AWS, and None for addressing is the
default style. Location states the rules.
§Errors
Error::InvalidInput in these cases:
regionis refused bySigV4::newcheck_base_urlrefusesendpoint, orendpointhas a path. The message holds no userinfo.- virtual-host style with a bucket name that holds a
.overhttps - virtual-host style with an endpoint whose host is an IP address.
Sourcepub fn from_resolved(address: Address, resolved: &Resolved) -> Result<Location>
pub fn from_resolved(address: Address, resolved: &Resolved) -> Result<Location>
Returns the location of address with the region, the endpoint, and
the addressing style of resolved.
§Errors
The errors of Location::new. A refused endpoint names the source
of the endpoint.
Sourcepub fn addressing(&self) -> Addressing
pub fn addressing(&self) -> Addressing
Returns the addressing style in use.
Sourcepub fn endpoint(&self) -> &str
pub fn endpoint(&self) -> &str
Returns the endpoint in use, with no trailing /: the endpoint of the
caller, or https://s3.REGION.amazonaws.com.
Sourcepub fn bucket_url(&self) -> String
pub fn bucket_url(&self) -> String
Returns the URL of the bucket: ENDPOINT/BUCKET for path style, and
SCHEME://BUCKET.HOST[:PORT] for virtual-host style.
The bucket client sends each request under this URL.
Sourcepub fn repository_url(&self) -> String
pub fn repository_url(&self) -> String
Returns the base URL of the repository: the URL of the bucket, then
/ and the prefix if the address has one.
Trait Implementations§
impl Eq for Location
impl StructuralPartialEq for Location
Auto Trait Implementations§
impl Forget for Location
impl Freeze for Location
impl Move for Location
impl RefUnwindSafe for Location
impl Send for Locationwhere
RawVecInner: Send,
impl Sync for Locationwhere
RawVecInner: Sync,
impl Unpin for Location
impl UnsafeUnpin for Location
impl UnwindSafe for Locationwhere
RawVecInner: UnwindSafe,
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.