Acontplus.Common.S3Application
1.1.1
See the version list below for details.
dotnet add package Acontplus.Common.S3Application --version 1.1.1
NuGet\Install-Package Acontplus.Common.S3Application -Version 1.1.1
<PackageReference Include="Acontplus.Common.S3Application" Version="1.1.1" />
paket add Acontplus.Common.S3Application --version 1.1.1
#r "nuget: Acontplus.Common.S3Application, 1.1.1"
// Install Acontplus.Common.S3Application as a Cake Addin #addin nuget:?package=Acontplus.Common.S3Application&version=1.1.1 // Install Acontplus.Common.S3Application as a Cake Tool #tool nuget:?package=Acontplus.Common.S3Application&version=1.1.1
Common.S3Application
A lightweight .NET library providing a simple and consistent interface for AWS S3 storage operations. This package implements basic CRUD operations for S3 objects with async support.
Features
- Asynchronous S3 operations
- Strongly-typed S3 object handling
- Custom response wrapping
- Simple CRUD interface
- Task-based operation support
Installation
dotnet add package Common.S3Application
Quick Start
1. Interface Implementation
public interface IS3StorageService
{
Task<S3Response> UploadAsync(S3ObjectCustom s3ObjectCustom);
Task<S3Response> UpdateAsync(S3ObjectCustom s3ObjectCustom);
Task<S3Response> DeleteAsync(S3ObjectCustom s3ObjectCustom);
}
2. Basic Usage
public class MyS3Service
{
private readonly IS3StorageService _s3StorageService;
public MyS3Service(IS3StorageService s3StorageService)
{
_s3StorageService = s3StorageService;
}
public async Task UploadFileAsync(string fileName, byte[] content)
{
var s3Object = new S3ObjectCustom
{
FileName = fileName,
Content = content
};
var response = await _s3StorageService.UploadAsync(s3Object);
}
}
Dependencies
- .NET Standard 2.0+
- AWS SDK for .NET
- Common.Core (for S3Response and S3ObjectCustom types)
Configuration
Add the following to your appsettings.json:
{
"AWS": {
"Region": "your-region",
"BucketName": "your-bucket-name"
}
}
Service Registration
services.AddScoped<IS3StorageService, S3StorageService>();
Error Handling
The service returns S3Response
objects which include:
- Success/failure status
- Error messages if applicable
- Operation metadata
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License
Copyright (c) 2024 [Acontplus S.A.S.]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. |
-
net9.0
- Acontplus.Common.Core (>= 1.1.2)
- AWSSDK.Core (>= 3.7.400.50)
- AWSSDK.S3 (>= 3.7.405.14)
- BarcodeLib (>= 3.1.4)
- Microsoft.AspNetCore.Http.Features (>= 5.0.17)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.0)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.