Struct S3Config

Source
#[non_exhaustive]
pub struct S3Config {
Show 29 fields pub root: Option<String>, pub bucket: String, pub enable_versioning: bool, pub endpoint: Option<String>, pub region: Option<String>, pub access_key_id: Option<String>, pub secret_access_key: Option<String>, pub session_token: Option<String>, pub role_arn: Option<String>, pub external_id: Option<String>, pub role_session_name: Option<String>, pub disable_config_load: bool, pub disable_ec2_metadata: bool, pub allow_anonymous: bool, pub server_side_encryption: Option<String>, pub server_side_encryption_aws_kms_key_id: Option<String>, pub server_side_encryption_customer_algorithm: Option<String>, pub server_side_encryption_customer_key: Option<String>, pub server_side_encryption_customer_key_md5: Option<String>, pub default_storage_class: Option<String>, pub enable_virtual_host_style: bool, pub batch_max_operations: Option<usize>, pub delete_max_size: Option<usize>, pub disable_stat_with_override: bool, pub checksum_algorithm: Option<String>, pub disable_write_with_if_match: bool, pub enable_write_with_append: bool, pub disable_list_objects_v2: bool, pub enable_request_payer: bool,
}
Expand description

Config for Aws S3 and compatible services (including minio, digitalocean space, Tencent Cloud Object Storage(COS) and so on) support.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§root: Option<String>

root of this backend.

All operations will happen under this root.

default to / if not set.

§bucket: String

bucket name of this backend.

required.

§enable_versioning: bool

is bucket versioning enabled for this bucket

§endpoint: Option<String>

endpoint of this backend.

Endpoint must be full uri, e.g.

  • AWS S3: https://s3.amazonaws.com or https://s3.{region}.amazonaws.com
  • Cloudflare R2: https://<ACCOUNT_ID>.r2.cloudflarestorage.com
  • Aliyun OSS: https://{region}.aliyuncs.com
  • Tencent COS: https://cos.{region}.myqcloud.com
  • Minio: http://127.0.0.1:9000

If user inputs endpoint without scheme like “s3.amazonaws.com”, we will prepend “https://” before it.

  • If endpoint is set, we will take user’s input first.
  • If not, we will try to load it from environment.
  • If still not set, default to https://s3.amazonaws.com.
§region: Option<String>

Region represent the signing region of this endpoint. This is required if you are using the default AWS S3 endpoint.

If using a custom endpoint,

  • If region is set, we will take user’s input first.
  • If not, we will try to load it from environment.
§access_key_id: Option<String>

access_key_id of this backend.

  • If access_key_id is set, we will take user’s input first.
  • If not, we will try to load it from environment.
§secret_access_key: Option<String>

secret_access_key of this backend.

  • If secret_access_key is set, we will take user’s input first.
  • If not, we will try to load it from environment.
§session_token: Option<String>

session_token (aka, security token) of this backend.

This token will expire after sometime, it’s recommended to set session_token by hand.

§role_arn: Option<String>

role_arn for this backend.

If role_arn is set, we will use already known config as source credential to assume role with role_arn.

§external_id: Option<String>

external_id for this backend.

§role_session_name: Option<String>

role_session_name for this backend.

§disable_config_load: bool

Disable config load so that opendal will not load config from environment.

For examples:

  • envs like AWS_ACCESS_KEY_ID
  • files like ~/.aws/config
§disable_ec2_metadata: bool

Disable load credential from ec2 metadata.

This option is used to disable the default behavior of opendal to load credential from ec2 metadata, a.k.a, IMDSv2

§allow_anonymous: bool

Allow anonymous will allow opendal to send request without signing when credential is not loaded.

§server_side_encryption: Option<String>

server_side_encryption for this backend.

Available values: AES256, aws:kms.

§server_side_encryption_aws_kms_key_id: Option<String>

server_side_encryption_aws_kms_key_id for this backend

  • If server_side_encryption set to aws:kms, and server_side_encryption_aws_kms_key_id is not set, S3 will use aws managed kms key to encrypt data.
  • If server_side_encryption set to aws:kms, and server_side_encryption_aws_kms_key_id is a valid kms key id, S3 will use the provided kms key to encrypt data.
  • If the server_side_encryption_aws_kms_key_id is invalid or not found, an error will be returned.
  • If server_side_encryption is not aws:kms, setting server_side_encryption_aws_kms_key_id is a noop.
§server_side_encryption_customer_algorithm: Option<String>

server_side_encryption_customer_algorithm for this backend.

Available values: AES256.

§server_side_encryption_customer_key: Option<String>

server_side_encryption_customer_key for this backend.

Value: BASE64-encoded key that matches algorithm specified in server_side_encryption_customer_algorithm.

§server_side_encryption_customer_key_md5: Option<String>

Set server_side_encryption_customer_key_md5 for this backend.

Value: MD5 digest of key specified in server_side_encryption_customer_key.

§default_storage_class: Option<String>

default storage_class for this backend.

Available values:

  • DEEP_ARCHIVE
  • GLACIER
  • GLACIER_IR
  • INTELLIGENT_TIERING
  • ONEZONE_IA
  • EXPRESS_ONEZONE
  • OUTPOSTS
  • REDUCED_REDUNDANCY
  • STANDARD
  • STANDARD_IA

S3 compatible services don’t support all of them

§enable_virtual_host_style: bool

Enable virtual host style so that opendal will send API requests in virtual host style instead of path style.

  • By default, opendal will send API to https://s3.us-east-1.amazonaws.com/bucket_name
  • Enabled, opendal will send API to https://bucket_name.s3.us-east-1.amazonaws.com
§batch_max_operations: Option<usize>
👎Deprecated since 0.52.0: Please use delete_max_size instead of batch_max_operations

Set maximum batch operations of this backend.

Some compatible services have a limit on the number of operations in a batch request. For example, R2 could return Internal Error while batch delete 1000 files.

Please tune this value based on services’ document.

§delete_max_size: Option<usize>

Set the maximum delete size of this backend.

Some compatible services have a limit on the number of operations in a batch request. For example, R2 could return Internal Error while batch delete 1000 files.

Please tune this value based on services’ document.

§disable_stat_with_override: bool

Disable stat with override so that opendal will not send stat request with override queries.

For example, R2 doesn’t support stat with response_content_type query.

§checksum_algorithm: Option<String>

Checksum Algorithm to use when sending checksums in HTTP headers. This is necessary when writing to AWS S3 Buckets with Object Lock enabled for example.

Available options:

  • “crc32c”
§disable_write_with_if_match: bool

Disable write with if match so that opendal will not send write request with if match headers.

For example, Ceph RADOS S3 doesn’t support write with if match.

§enable_write_with_append: bool

Enable write with append so that opendal will send write request with append headers.

§disable_list_objects_v2: bool

OpenDAL uses List Objects V2 by default to list objects. However, some legacy services do not yet support V2. This option allows users to switch back to the older List Objects V1.

§enable_request_payer: bool

Indicates whether the client agrees to pay for the requests made to the S3 bucket.

Trait Implementations§

Source§

impl Clone for S3Config

Source§

fn clone(&self) -> S3Config

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 Configurator for S3Config

Source§

type Builder = S3Builder

Associated builder for this configuration.
Source§

fn into_builder(self) -> Self::Builder

Convert this configuration into a service builder.
Source§

fn from_iter(iter: impl IntoIterator<Item = (String, String)>) -> Result<Self>

Deserialize from an iterator. Read more
Source§

impl Debug for S3Config

Source§

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

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

impl Default for S3Config

Source§

fn default() -> S3Config

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

impl<'de> Deserialize<'de> for S3Config

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for S3Config

Source§

fn eq(&self, other: &S3Config) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for S3Config

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for S3Config

Source§

impl StructuralPartialEq for S3Config

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> ServiceExt for T

Source§

fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>
where Self: Sized,

Apply a transformation to the response body. Read more
Source§

fn decompression(self) -> Decompression<Self>
where Self: Sized,

Decompress response bodies. Read more
Source§

fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using HTTP status codes. Read more
Source§

fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using gRPC headers. Read more
Source§

fn follow_redirects(self) -> FollowRedirect<Self>
where Self: Sized,

Follow redirect resposes using the Standard policy. Read more
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> MaybeSend for T
where T: Send,