English | 中文
This is a .NET S3 demo project implemented using RustFS technology, demonstrating how to interact with S3-compatible storage services in a .NET environment.
This project mainly implements the following functions:
- Bucket Management: Create, delete, check existence, and list all buckets
- File Management: Upload, download, delete, and list files within a bucket
- Unified API response format
- Exception handling middleware
- Perform object storage operations using AWS S3-compatible APIs
- Clear error handling and response format
- Modular code structure
- Support for asynchronous operations
All APIs follow a unified response format containing the following fields:
- Success: Whether the operation was successful
- Code: HTTP status code
- Message: Description of the operation result
- Data: Returned data (if any)
POST /api/bucket/{bucketName}
POST /api/file/upload/{bucketName}/{key}
Form-data: file=@local_file_path
GET /api/file/download/{bucketName}/{key}
DELETE /api/file/{bucketName}/{key}
- Controllers: Contains controller classes such as BucketManageController.cs and FileManageController.cs
- Extensions: Contains controller extension methods
- Handlers: Contains classes related to exception handling
- Models: Contains response model classes
- Services: Contains AWS S3 service implementation
- Settings: Contains AWS S3 configuration settings
The project uses a unified exception handling mechanism. All exceptions will be converted into ProblemDetailsResponse format before being returned to the client.
AWS S3 connection information is configured through the AwsS3Setting class, which includes service URL, access key, secret key, and region settings.
This project is licensed under the MIT License.
👉 Special thanks to @zfchai submit the initialization code.