Skip to main content

S3Bucket

Struct S3Bucket 

Source
pub struct S3Bucket {
Show 27 fields pub name: String, pub region: String, pub creation_date: DateTime<Utc>, pub owner: Owner, pub objects: RwLock<ObjectStore>, pub multipart_uploads: DashMap<String, MultipartUpload>, pub versioning: RwLock<VersioningStatus>, pub encryption: RwLock<Option<BucketEncryption>>, pub cors_rules: RwLock<Option<Vec<CorsRuleConfig>>>, pub lifecycle: RwLock<Option<BucketLifecycleConfiguration>>, pub policy: RwLock<Option<String>>, pub tags: RwLock<Vec<(String, String)>>, pub acl: RwLock<CannedAcl>, pub notification_configuration: RwLock<Option<NotificationConfiguration>>, pub logging: RwLock<Option<Value>>, pub public_access_block: RwLock<Option<PublicAccessBlockConfig>>, pub ownership_controls: RwLock<Option<OwnershipControlsConfig>>, pub object_lock_enabled: RwLock<bool>, pub object_lock_configuration: RwLock<Option<ObjectLockConfiguration>>, pub accelerate: RwLock<Option<String>>, pub request_payment: RwLock<String>, pub website: RwLock<Option<WebsiteConfig>>, pub replication: RwLock<Option<Value>>, pub analytics: RwLock<Option<Value>>, pub metrics: RwLock<Option<Value>>, pub inventory: RwLock<Option<Value>>, pub intelligent_tiering: RwLock<Option<Value>>,
}
Expand description

An S3 bucket with all its state and configuration.

Thread-safe: interior fields use parking_lot::RwLock for configuration and objects, DashMap for multipart uploads.

Fields§

§name: String

Bucket name.

§region: String

AWS region where this bucket was created.

§creation_date: DateTime<Utc>

When the bucket was created.

§owner: Owner

The bucket owner.

§objects: RwLock<ObjectStore>

Object key storage (un-versioned or versioned).

§multipart_uploads: DashMap<String, MultipartUpload>

In-progress multipart uploads, keyed by upload ID.

§versioning: RwLock<VersioningStatus>

Bucket versioning status.

§encryption: RwLock<Option<BucketEncryption>>

Server-side encryption configuration.

§cors_rules: RwLock<Option<Vec<CorsRuleConfig>>>

CORS rules.

§lifecycle: RwLock<Option<BucketLifecycleConfiguration>>

Lifecycle configuration.

§policy: RwLock<Option<String>>

Bucket policy (JSON string).

§tags: RwLock<Vec<(String, String)>>

Bucket tags.

§acl: RwLock<CannedAcl>

Canned ACL for the bucket.

§notification_configuration: RwLock<Option<NotificationConfiguration>>

Notification configuration for the bucket.

§logging: RwLock<Option<Value>>

Logging configuration (stored as opaque JSON).

§public_access_block: RwLock<Option<PublicAccessBlockConfig>>

Public access block settings.

§ownership_controls: RwLock<Option<OwnershipControlsConfig>>

Ownership controls.

§object_lock_enabled: RwLock<bool>

Whether Object Lock is enabled on this bucket.

§object_lock_configuration: RwLock<Option<ObjectLockConfiguration>>

Object Lock configuration (retention rules).

§accelerate: RwLock<Option<String>>

Transfer acceleration status (e.g. "Enabled", "Suspended").

§request_payment: RwLock<String>

Request payment configuration (default "BucketOwner").

§website: RwLock<Option<WebsiteConfig>>

Static website hosting configuration.

§replication: RwLock<Option<Value>>

Replication configuration (stored as opaque JSON).

§analytics: RwLock<Option<Value>>

Analytics configuration (stored as opaque JSON).

§metrics: RwLock<Option<Value>>

Metrics configuration (stored as opaque JSON).

§inventory: RwLock<Option<Value>>

Inventory configuration (stored as opaque JSON).

§intelligent_tiering: RwLock<Option<Value>>

Intelligent-Tiering configuration (stored as opaque JSON).

Implementations§

Source§

impl S3Bucket

Source

pub fn new(name: String, region: String, owner: Owner) -> Self

Create a new bucket with the given name, region, and owner.

All configuration fields are initialized to their defaults.

Source

pub fn is_empty(&self) -> bool

Whether the bucket contains zero objects (and no in-progress multipart uploads).

Source

pub fn is_versioning_enabled(&self) -> bool

Whether versioning is currently enabled on this bucket.

Source

pub fn enable_versioning(&self)

Enable versioning on this bucket.

If the bucket is currently un-versioned, the object store is transitioned to a super::keystore::VersionedKeyStore. If versioning was suspended, it is simply re-enabled.

Source

pub fn suspend_versioning(&self)

Suspend versioning on this bucket.

Objects already stored retain their version history. New puts will receive a version ID of "null" (overwriting any existing "null" version).

Trait Implementations§

Source§

impl Debug for S3Bucket

Source§

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

Formats the value using the given formatter. 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> 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> 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