Skip to main content

RustackS3

Struct RustackS3 

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

The main S3 provider.

All fields are Arc-wrapped for cheap cloning and shared ownership across handler tasks.

§Examples

use rustack_s3_core::RustackS3;
use rustack_s3_core::config::S3Config;

let provider = RustackS3::new(S3Config::default());
assert!(!provider.config().gateway_listen.is_empty());

Implementations§

Source§

impl RustackS3

Source

pub async fn handle_create_bucket( &self, input: CreateBucketInput, ) -> Result<CreateBucketOutput, S3Error>

Create a new S3 bucket.

Source

pub async fn handle_delete_bucket( &self, input: DeleteBucketInput, ) -> Result<(), S3Error>

Delete an S3 bucket.

Source

pub async fn handle_head_bucket( &self, input: HeadBucketInput, ) -> Result<HeadBucketOutput, S3Error>

Check if a bucket exists and is accessible (HEAD Bucket).

Source

pub async fn handle_list_buckets( &self, _input: ListBucketsInput, ) -> Result<ListBucketsOutput, S3Error>

List all buckets.

Source

pub async fn handle_get_bucket_location( &self, input: GetBucketLocationInput, ) -> Result<GetBucketLocationOutput, S3Error>

Get the location (region) of a bucket.

Source§

impl RustackS3

Source

pub async fn handle_get_bucket_versioning( &self, input: GetBucketVersioningInput, ) -> Result<GetBucketVersioningOutput, S3Error>

Get the versioning configuration for a bucket.

Source

pub async fn handle_put_bucket_versioning( &self, input: PutBucketVersioningInput, ) -> Result<(), S3Error>

Set the versioning configuration for a bucket.

Source

pub async fn handle_get_bucket_encryption( &self, input: GetBucketEncryptionInput, ) -> Result<GetBucketEncryptionOutput, S3Error>

Get the server-side encryption configuration for a bucket.

Source

pub async fn handle_put_bucket_encryption( &self, input: PutBucketEncryptionInput, ) -> Result<(), S3Error>

Set the server-side encryption configuration for a bucket.

Source

pub async fn handle_delete_bucket_encryption( &self, input: DeleteBucketEncryptionInput, ) -> Result<(), S3Error>

Delete the server-side encryption configuration for a bucket.

Source

pub async fn handle_get_bucket_cors( &self, input: GetBucketCorsInput, ) -> Result<GetBucketCorsOutput, S3Error>

Get CORS configuration for a bucket.

Source

pub async fn handle_put_bucket_cors( &self, input: PutBucketCorsInput, ) -> Result<(), S3Error>

Set CORS configuration for a bucket.

Source

pub async fn handle_delete_bucket_cors( &self, input: DeleteBucketCorsInput, ) -> Result<(), S3Error>

Delete CORS configuration for a bucket.

Source

pub async fn handle_get_bucket_lifecycle_configuration( &self, input: GetBucketLifecycleConfigurationInput, ) -> Result<GetBucketLifecycleConfigurationOutput, S3Error>

Get lifecycle configuration for a bucket.

Source

pub async fn handle_put_bucket_lifecycle_configuration( &self, input: PutBucketLifecycleConfigurationInput, ) -> Result<PutBucketLifecycleConfigurationOutput, S3Error>

Set lifecycle configuration for a bucket.

Source

pub async fn handle_delete_bucket_lifecycle( &self, input: DeleteBucketLifecycleInput, ) -> Result<(), S3Error>

Delete lifecycle configuration for a bucket.

Source

pub async fn handle_get_bucket_policy( &self, input: GetBucketPolicyInput, ) -> Result<GetBucketPolicyOutput, S3Error>

Get the bucket policy.

Source

pub async fn handle_put_bucket_policy( &self, input: PutBucketPolicyInput, ) -> Result<(), S3Error>

Set the bucket policy.

Source

pub async fn handle_delete_bucket_policy( &self, input: DeleteBucketPolicyInput, ) -> Result<(), S3Error>

Delete the bucket policy.

Source

pub async fn handle_get_bucket_tagging( &self, input: GetBucketTaggingInput, ) -> Result<GetBucketTaggingOutput, S3Error>

Get the tag set for a bucket.

Source

pub async fn handle_put_bucket_tagging( &self, input: PutBucketTaggingInput, ) -> Result<(), S3Error>

Set the tag set for a bucket.

Source

pub async fn handle_delete_bucket_tagging( &self, input: DeleteBucketTaggingInput, ) -> Result<(), S3Error>

Delete the tag set for a bucket.

Source

pub async fn handle_get_bucket_notification_configuration( &self, input: GetBucketNotificationConfigurationInput, ) -> Result<GetBucketNotificationConfigurationOutput, S3Error>

Get notification configuration for a bucket.

Source

pub async fn handle_put_bucket_notification_configuration( &self, input: PutBucketNotificationConfigurationInput, ) -> Result<(), S3Error>

Set notification configuration for a bucket.

Source

pub async fn handle_get_bucket_logging( &self, input: GetBucketLoggingInput, ) -> Result<GetBucketLoggingOutput, S3Error>

Get logging configuration for a bucket.

Source

pub async fn handle_put_bucket_logging( &self, input: PutBucketLoggingInput, ) -> Result<(), S3Error>

Set logging configuration for a bucket.

Source

pub async fn handle_get_public_access_block( &self, input: GetPublicAccessBlockInput, ) -> Result<GetPublicAccessBlockOutput, S3Error>

Get public access block configuration for a bucket.

Source

pub async fn handle_put_public_access_block( &self, input: PutPublicAccessBlockInput, ) -> Result<(), S3Error>

Set public access block configuration for a bucket.

Source

pub async fn handle_delete_public_access_block( &self, input: DeletePublicAccessBlockInput, ) -> Result<(), S3Error>

Delete public access block configuration for a bucket.

Source

pub async fn handle_get_bucket_ownership_controls( &self, input: GetBucketOwnershipControlsInput, ) -> Result<GetBucketOwnershipControlsOutput, S3Error>

Get ownership controls configuration for a bucket.

Source

pub async fn handle_put_bucket_ownership_controls( &self, input: PutBucketOwnershipControlsInput, ) -> Result<(), S3Error>

Set ownership controls configuration for a bucket.

Source

pub async fn handle_delete_bucket_ownership_controls( &self, input: DeleteBucketOwnershipControlsInput, ) -> Result<(), S3Error>

Delete ownership controls configuration for a bucket.

Source

pub async fn handle_get_object_lock_configuration( &self, input: GetObjectLockConfigurationInput, ) -> Result<GetObjectLockConfigurationOutput, S3Error>

Get object lock configuration for a bucket.

Source

pub async fn handle_put_object_lock_configuration( &self, input: PutObjectLockConfigurationInput, ) -> Result<PutObjectLockConfigurationOutput, S3Error>

Set object lock configuration for a bucket.

Source

pub async fn handle_get_bucket_accelerate_configuration( &self, input: GetBucketAccelerateConfigurationInput, ) -> Result<GetBucketAccelerateConfigurationOutput, S3Error>

Get the transfer acceleration configuration for a bucket.

Source

pub async fn handle_put_bucket_accelerate_configuration( &self, input: PutBucketAccelerateConfigurationInput, ) -> Result<(), S3Error>

Set the transfer acceleration configuration for a bucket.

Source

pub async fn handle_get_bucket_request_payment( &self, input: GetBucketRequestPaymentInput, ) -> Result<GetBucketRequestPaymentOutput, S3Error>

Get the request payment configuration for a bucket.

Source

pub async fn handle_put_bucket_request_payment( &self, input: PutBucketRequestPaymentInput, ) -> Result<(), S3Error>

Set the request payment configuration for a bucket.

Source

pub async fn handle_get_bucket_website( &self, input: GetBucketWebsiteInput, ) -> Result<GetBucketWebsiteOutput, S3Error>

Get the website configuration for a bucket.

Source

pub async fn handle_put_bucket_website( &self, input: PutBucketWebsiteInput, ) -> Result<(), S3Error>

Set the website configuration for a bucket.

Source

pub async fn handle_delete_bucket_website( &self, input: DeleteBucketWebsiteInput, ) -> Result<(), S3Error>

Delete the website configuration for a bucket.

Source

pub async fn handle_get_bucket_acl( &self, input: GetBucketAclInput, ) -> Result<GetBucketAclOutput, S3Error>

Get the ACL for a bucket.

Source

pub async fn handle_put_bucket_acl( &self, input: PutBucketAclInput, ) -> Result<(), S3Error>

Set the ACL for a bucket.

Source

pub async fn handle_get_bucket_policy_status( &self, input: GetBucketPolicyStatusInput, ) -> Result<GetBucketPolicyStatusOutput, S3Error>

Get the policy status for a bucket.

Source§

impl RustackS3

Source

pub async fn handle_list_objects( &self, input: ListObjectsInput, ) -> Result<ListObjectsOutput, S3Error>

List objects (v1 API).

Source

pub async fn handle_list_objects_v2( &self, input: ListObjectsV2Input, ) -> Result<ListObjectsV2Output, S3Error>

List objects (v2 API with continuation tokens).

Source

pub async fn handle_list_object_versions( &self, input: ListObjectVersionsInput, ) -> Result<ListObjectVersionsOutput, S3Error>

List object versions.

Source§

impl RustackS3

Source

pub async fn handle_create_multipart_upload( &self, input: CreateMultipartUploadInput, ) -> Result<CreateMultipartUploadOutput, S3Error>

Create a new multipart upload.

Source

pub async fn handle_upload_part( &self, input: UploadPartInput, ) -> Result<UploadPartOutput, S3Error>

Upload a single part of a multipart upload.

Source

pub async fn handle_upload_part_copy( &self, input: UploadPartCopyInput, ) -> Result<UploadPartCopyOutput, S3Error>

Upload a part by copying from an existing object.

Source

pub async fn handle_complete_multipart_upload( &self, input: CompleteMultipartUploadInput, ) -> Result<CompleteMultipartUploadOutput, S3Error>

Complete a multipart upload by assembling parts into the final object.

Source

pub async fn handle_abort_multipart_upload( &self, input: AbortMultipartUploadInput, ) -> Result<AbortMultipartUploadOutput, S3Error>

Abort a multipart upload.

Source

pub async fn handle_list_parts( &self, input: ListPartsInput, ) -> Result<ListPartsOutput, S3Error>

List parts that have been uploaded for a multipart upload.

Source

pub async fn handle_list_multipart_uploads( &self, input: ListMultipartUploadsInput, ) -> Result<ListMultipartUploadsOutput, S3Error>

List in-progress multipart uploads for a bucket.

Source§

impl RustackS3

Source

pub async fn handle_put_object( &self, input: PutObjectInput, ) -> Result<PutObjectOutput, S3Error>

Put (upload) a new object.

Source

pub async fn handle_get_object( &self, input: GetObjectInput, ) -> Result<GetObjectOutput, S3Error>

Get (download) an object.

Source

pub async fn handle_head_object( &self, input: HeadObjectInput, ) -> Result<HeadObjectOutput, S3Error>

Head object (get metadata without body).

Source

pub async fn handle_delete_object( &self, input: DeleteObjectInput, ) -> Result<DeleteObjectOutput, S3Error>

Delete a single object.

Source

pub async fn handle_delete_objects( &self, input: DeleteObjectsInput, ) -> Result<DeleteObjectsOutput, S3Error>

Delete multiple objects (bulk delete).

Source

pub async fn handle_copy_object( &self, input: CopyObjectInput, ) -> Result<CopyObjectOutput, S3Error>

Copy an object from a source to a destination.

Source§

impl RustackS3

Source

pub async fn handle_get_object_tagging( &self, input: GetObjectTaggingInput, ) -> Result<GetObjectTaggingOutput, S3Error>

Get tags for an object.

Source

pub async fn handle_put_object_tagging( &self, input: PutObjectTaggingInput, ) -> Result<PutObjectTaggingOutput, S3Error>

Set tags for an object.

Source

pub async fn handle_delete_object_tagging( &self, input: DeleteObjectTaggingInput, ) -> Result<DeleteObjectTaggingOutput, S3Error>

Delete tags for an object.

Source

pub async fn handle_get_object_acl( &self, input: GetObjectAclInput, ) -> Result<GetObjectAclOutput, S3Error>

Get the ACL for an object.

Source

pub async fn handle_put_object_acl( &self, input: PutObjectAclInput, ) -> Result<PutObjectAclOutput, S3Error>

Set the ACL for an object.

Source

pub async fn handle_get_object_retention( &self, input: GetObjectRetentionInput, ) -> Result<GetObjectRetentionOutput, S3Error>

Get the retention configuration for an object.

Source

pub async fn handle_put_object_retention( &self, input: PutObjectRetentionInput, ) -> Result<PutObjectRetentionOutput, S3Error>

Set the retention configuration for an object.

Get the legal hold status for an object.

Set the legal hold status for an object.

Source

pub async fn handle_get_object_attributes( &self, input: GetObjectAttributesInput, ) -> Result<GetObjectAttributesOutput, S3Error>

Get attributes for an object.

Source§

impl RustackS3

Source

pub fn new(config: S3Config) -> Self

Create a new S3 provider with the given configuration.

Initializes an empty service state, a storage backend configured with the memory threshold from config, and an empty CORS index.

Source

pub fn state(&self) -> &S3ServiceState

Returns a reference to the service state.

Source

pub fn storage(&self) -> &InMemoryStorage

Returns a reference to the storage backend.

Source

pub fn cors_index(&self) -> &CorsIndex

Returns a reference to the CORS index.

Source

pub fn config(&self) -> &S3Config

Returns a reference to the provider configuration.

Source

pub fn reset(&self)

Reset all state (buckets, objects, multipart uploads, CORS rules).

Primarily useful for testing and the /_localstack/health reset endpoint.

Source§

impl RustackS3

Source

pub async fn export_snapshot( &self, data_dir: &Path, ) -> Result<S3Snapshot, S3SnapshotError>

Export S3 state and object bodies into a snapshot.

§Errors

Returns an error if object bodies cannot be read or written.

Source

pub async fn import_snapshot( &self, snapshot: S3Snapshot, data_dir: &Path, ) -> Result<(), S3SnapshotError>

Import S3 state and object bodies from a snapshot.

§Errors

Returns an error if object body files cannot be read or restored.

Trait Implementations§

Source§

impl Clone for RustackS3

Source§

fn clone(&self) -> RustackS3

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for RustackS3

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