Struct object_store::aws::AmazonS3Builder
source · [−]pub struct AmazonS3Builder { /* private fields */ }
Expand description
Configure a connection to Amazon S3 using the specified credentials in the specified Amazon region and bucket.
Example
let s3 = AmazonS3Builder::new()
.with_region(REGION)
.with_bucket_name(BUCKET_NAME)
.with_access_key_id(ACCESS_KEY_ID)
.with_secret_access_key(SECRET_KEY)
.build();
Implementations
sourceimpl AmazonS3Builder
impl AmazonS3Builder
sourcepub fn new() -> Self
pub fn new() -> Self
Create a new AmazonS3Builder
with default values.
sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Fill the AmazonS3Builder
with regular AWS environment variables
Variables extracted from environment:
- AWS_ACCESS_KEY_ID -> access_key_id
- AWS_SECRET_ACCESS_KEY -> secret_access_key
- AWS_DEFAULT_REGION -> region
- AWS_ENDPOINT -> endpoint
- AWS_SESSION_TOKEN -> token
Example
use object_store::aws::AmazonS3Builder;
let s3 = AmazonS3Builder::from_env()
.with_bucket_name("foo")
.build();
sourcepub fn with_access_key_id(self, access_key_id: impl Into<String>) -> Self
pub fn with_access_key_id(self, access_key_id: impl Into<String>) -> Self
Set the AWS Access Key (required)
sourcepub fn with_secret_access_key(self, secret_access_key: impl Into<String>) -> Self
pub fn with_secret_access_key(self, secret_access_key: impl Into<String>) -> Self
Set the AWS Secret Access Key (required)
sourcepub fn with_region(self, region: impl Into<String>) -> Self
pub fn with_region(self, region: impl Into<String>) -> Self
Set the region (e.g. us-east-1
) (required)
sourcepub fn with_bucket_name(self, bucket_name: impl Into<String>) -> Self
pub fn with_bucket_name(self, bucket_name: impl Into<String>) -> Self
Set the bucket_name (required)
sourcepub fn with_endpoint(self, endpoint: impl Into<String>) -> Self
pub fn with_endpoint(self, endpoint: impl Into<String>) -> Self
Sets the endpoint for communicating with AWS S3. Default value is based on region.
For example, this might be set to "http://localhost:4566:
for testing against a localstack instance.
sourcepub fn with_token(self, token: impl Into<String>) -> Self
pub fn with_token(self, token: impl Into<String>) -> Self
Set the token to use for requests (passed to underlying provider)
sourcepub fn with_allow_http(self, allow_http: bool) -> Self
pub fn with_allow_http(self, allow_http: bool) -> Self
Sets what protocol is allowed. If allow_http
is :
- false (default): Only HTTPS are allowed
- true: HTTP and HTTPS are allowed
sourcepub fn with_retry(self, retry_config: RetryConfig) -> Self
pub fn with_retry(self, retry_config: RetryConfig) -> Self
Set the retry configuration
sourcepub fn with_imdsv1_fallback(self) -> Self
pub fn with_imdsv1_fallback(self) -> Self
By default instance credentials will only be fetched over IMDSv2, as AWS recommends against having IMDSv1 enabled on EC2 instances as it is vulnerable to SSRF attack
However, certain deployment environments, such as those running old versions of kube2iam, may not support IMDSv2. This option will enable automatic fallback to using IMDSv1 if the token endpoint returns a 403 error indicating that IMDSv2 is not supported.
This option has no effect if not using instance credentials
Trait Implementations
sourceimpl Debug for AmazonS3Builder
impl Debug for AmazonS3Builder
sourceimpl Default for AmazonS3Builder
impl Default for AmazonS3Builder
sourcefn default() -> AmazonS3Builder
fn default() -> AmazonS3Builder
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for AmazonS3Builder
impl Send for AmazonS3Builder
impl Sync for AmazonS3Builder
impl Unpin for AmazonS3Builder
impl UnwindSafe for AmazonS3Builder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more