Skip to main content

GetObjectOptions

Struct GetObjectOptions 

Source
pub struct GetObjectOptions {
    pub range: Option<String>,
    pub if_modified_since: Option<String>,
    pub if_unmodified_since: Option<String>,
    pub if_match: Option<String>,
    pub if_none_match: Option<String>,
    pub accept_encoding: Option<String>,
    pub response_content_language: Option<String>,
    pub response_expires: Option<String>,
    pub response_cache_control: Option<String>,
    pub response_content_disposition: Option<String>,
    pub response_content_encoding: Option<ContentEncoding>,
    pub version_id: Option<String>,
}
Expand description

Options for getting object

Official document: https://help.aliyun.com/zh/oss/developer-reference/getobject

Fields§

§range: Option<String>

指定文件传输的范围。

  • 如果指定的范围符合规范,返回消息中会包含整个 Object 的大小和此次返回 Object 的范围。例如:Content-Range: bytes 0~9/44,表示整个 Object 大小为 44,此次返回的范围为 0~9
  • 如果指定的范围不符合规范,则传送整个 Object,并且结果中不包含 Content-Range
§if_modified_since: Option<String>

GMT 日期时间字符串,例如:Fri, 13 Nov 2015 14:47:53 GMT

如果指定的时间早于实际修改时间或指定的时间不符合规范,则直接返回 Object,并返回 200 OK; 如果指定的时间等于或者晚于实际修改时间,则返回 304 Not Modified

§if_unmodified_since: Option<String>

GMT 日期时间字符串,例如:Fri, 13 Nov 2015 14:47:53 GMT

如果指定的时间等于或者晚于 Object 实际修改时间,则正常传输 Object,并返回 200 OK; 如果指定的时间早于实际修改时间,则返回 412 Precondition FailedIf-Modified-SinceIf-Unmodified-Since 可以同时使用。

§if_match: Option<String>

ETag 值

如果传入的 ETag 和 Object 的 ETag 匹配,则正常传输 Object,并返回 200 OK; 如果传入的 ETag 和 Object 的 ETag 不匹配,则返回 412 Precondition Failed

§if_none_match: Option<String>

ETag 值

如果传入的 ETag 值和 ObjectETag 不匹配,则正常传输 Object,并返回 200 OK; 如果传入的 ETagObjectETag 匹配,则返回 304 Not Modified

If-MatchIf-None-Match 可以同时使用。

§accept_encoding: Option<String>

指定客户端的编码类型。例如:gzip

如果要对返回内容进行 Gzip 压缩传输,您需要在请求头中以显示方式加入 Accept-Encoding:gzip。 OSS 会根据 Object 的 Content-Type 和 Object 大小(不小于1KB), 判断传输过程中是否对数据进行 Gzip 压缩。满足条件时,数据以压缩形式传输,否则,数据以原始形式传输。

注意:

  • 如果采用了 Gzip 压缩且压缩生效,则不会附带 ETagContent-Length 信息。
  • 目前 OSS 支持对以下 Content-Type 类型的数据进行 Gzip 压缩:
    • text/cache-manifest
    • text/xml
    • text/css
    • text/html
    • text/plain
    • application/javascript
    • application/x-javascript
    • application/rss+xml
    • application/json
    • text/json
§response_content_language: Option<String>

Add Content-Language to response header

§response_expires: Option<String>

Add Expires to response header

§response_cache_control: Option<String>

Add Cache-Control to response header

§response_content_disposition: Option<String>

Add Content-Disposition to response header

§response_content_encoding: Option<ContentEncoding>

Add Content-Encoding to response header

§version_id: Option<String>

The version to retreive

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more