Skip to main content

ClientOptions

Struct ClientOptions 

Source
pub struct ClientOptions { /* private fields */ }
Expand description

HTTP client configuration for remote object stores

Implementations§

Source§

impl ClientOptions

Source

pub fn new() -> Self

Create a new ClientOptions with default values

Source

pub fn with_config(self, key: ClientConfigKey, value: impl Into<String>) -> Self

Set an option by key

Source

pub fn get_config_value(&self, key: &ClientConfigKey) -> Option<String>

Get an option by key

Source

pub fn with_user_agent(self, agent: HeaderValue) -> Self

Sets the User-Agent header to be used by this client

Default is based on the version of this crate

Source

pub fn with_root_certificate(self, certificate: Certificate) -> Self

Add a custom root certificate.

This can be used to connect to a server that has a self-signed certificate for example.

Source

pub fn with_default_content_type(self, mime: impl Into<String>) -> Self

Set the default Content-Type for uploads

Source

pub fn with_content_type_for_suffix( self, extension: impl Into<String>, mime: impl Into<String>, ) -> Self

Set the Content-Type for a given file extension

Source

pub fn with_default_headers(self, headers: HeaderMap) -> Self

Sets the default headers for every request

Source

pub fn with_allow_http(self, allow_http: bool) -> Self

Sets what protocol is allowed.

If allow_http is :

  • false (default): Only HTTPS is allowed
  • true: HTTP and HTTPS are allowed
Source

pub fn with_allow_invalid_certificates(self, allow_insecure: bool) -> Self

Allows connections to invalid SSL certificates

If allow_invalid_certificates is :

  • false (default): Only valid HTTPS certificates are allowed
  • true: All HTTPS certificates are allowed

Warning

You should think very carefully before using this method. If invalid certificates are trusted, any certificate for any site will be trusted for use. This includes expired certificates. This introduces significant vulnerabilities, and should only be used as a last resort or for testing

Source

pub fn with_http1_only(self) -> Self

Only use HTTP/1 connections (default)

§See Also
HTTP/2 is not used by default. See details [#104](https://github.com/apache/arrow-rs-object-store/issues/104)
Source

pub fn with_http2_only(self) -> Self

Only use HTTP/2 connections

§See Also
HTTP/2 is not used by default. See details [#104](https://github.com/apache/arrow-rs-object-store/issues/104)
Source

pub fn with_allow_http2(self) -> Self

Use HTTP/2 if supported, otherwise use HTTP/1.

§See Also
HTTP/2 is not used by default. See details [#104](https://github.com/apache/arrow-rs-object-store/issues/104)
Source

pub fn with_proxy_url(self, proxy_url: impl Into<String>) -> Self

Set a proxy URL to use for requests

Source

pub fn with_proxy_ca_certificate( self, proxy_ca_certificate: impl Into<String>, ) -> Self

Set a trusted proxy CA certificate

Source

pub fn with_proxy_excludes(self, proxy_excludes: impl Into<String>) -> Self

Set a list of hosts to exclude from proxy connections

Source

pub fn with_timeout(self, timeout: Duration) -> Self

Set timeout for the overall request

The timeout starts from when the request starts connecting until the response body has finished. If the request does not complete within the timeout, the client returns a timeout error.

Timeout errors are retried, subject to the RetryConfig

Default is 30 seconds

§See Also
Source

pub fn with_timeout_disabled(self) -> Self

Disables the request timeout

§See Also
Source

pub fn with_connect_timeout(self, timeout: Duration) -> Self

Set a timeout for only the connect phase of a Client

This is the time allowed for the client to establish a connection and if the connection is not established within this time, the client returns a timeout error.

Timeout errors are retried, subject to the RetryConfig

Default is 5 seconds

§See Also
Source

pub fn with_connect_timeout_disabled(self) -> Self

Disables the connection timeout

§See Also
Source

pub fn with_pool_idle_timeout(self, timeout: Duration) -> Self

Set the pool max idle timeout

This is the length of time an idle connection will be kept alive

Default is 90 seconds enforced by reqwest

Source

pub fn with_pool_max_idle_per_host(self, max: usize) -> Self

Set the maximum number of idle connections per host

Default is no limit enforced by reqwest

Source

pub fn with_http2_keep_alive_interval(self, interval: Duration) -> Self

Sets an interval for HTTP/2 Ping frames should be sent to keep a connection alive.

Default is disabled enforced by reqwest

Source

pub fn with_http2_keep_alive_timeout(self, interval: Duration) -> Self

Sets a timeout for receiving an acknowledgement of the keep-alive ping.

If the ping is not acknowledged within the timeout, the connection will be closed. Does nothing if http2_keep_alive_interval is disabled.

Default is disabled enforced by reqwest

Source

pub fn with_http2_keep_alive_while_idle(self) -> Self

Enable HTTP/2 keep alive pings for idle connections

If disabled, keep-alive pings are only sent while there are open request/response streams. If enabled, pings are also sent when no streams are active

Default is disabled enforced by reqwest

Source

pub fn with_http2_max_frame_size(self, sz: u32) -> Self

Sets the maximum frame size to use for HTTP/2.

Default is currently 16,384 but may change internally to optimize for common uses.

Source

pub fn get_default_headers(&self) -> Option<&HeaderMap>

Get the default headers defined through ClientOptions::with_default_headers

Source

pub fn get_content_type(&self, path: &Path) -> Option<&str>

Get the mime type for the file in path to be uploaded

Gets the file extension from path, and returns the mime type if it was defined initially through ClientOptions::with_content_type_for_suffix

Otherwise, returns the default mime type if it was defined earlier through ClientOptions::with_default_content_type

Trait Implementations§

Source§

impl Clone for ClientOptions

Source§

fn clone(&self) -> ClientOptions

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ClientOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ClientOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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