Genbox.SimpleS3.Extensions.HttpClientFactory.Polly 3.2.2

Prefix Reserved
dotnet add package Genbox.SimpleS3.Extensions.HttpClientFactory.Polly --version 3.2.2                
NuGet\Install-Package Genbox.SimpleS3.Extensions.HttpClientFactory.Polly -Version 3.2.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Genbox.SimpleS3.Extensions.HttpClientFactory.Polly" Version="3.2.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Genbox.SimpleS3.Extensions.HttpClientFactory.Polly --version 3.2.2                
#r "nuget: Genbox.SimpleS3.Extensions.HttpClientFactory.Polly, 3.2.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Genbox.SimpleS3.Extensions.HttpClientFactory.Polly as a Cake Addin
#addin nuget:?package=Genbox.SimpleS3.Extensions.HttpClientFactory.Polly&version=3.2.2

// Install Genbox.SimpleS3.Extensions.HttpClientFactory.Polly as a Cake Tool
#tool nuget:?package=Genbox.SimpleS3.Extensions.HttpClientFactory.Polly&version=3.2.2                

SimpleS3

License

Description

A C# implementation of Amazon's S3 API with a focus on simplicity, security and performance. Download or upload an object with a single line of code.

S3 features

  • Streaming chunked encoding support.
  • Server-side encryption with customer keys.
  • Support for path and virtual host style buckets.
  • Support for pre-signed URLs.

API features

Features provided by SimpleS3:

  • Retry/timeout support via Polly.
  • Build requests through easy builder-based APIs. You never again have to remember the low-level details of a HTTP header.
  • Use the ProfileManager to manage credentials securely with in-memory encryption.
  • Full async and cancellation support.
  • Client-side validation of requests makes it easier to know what is wrong before sending a request.
  • Support uploading non-seekable streams or streams with no length.
  • Supports automatic URL decoding of XML responses to support special non-XML compliant characters.
  • Extensive unit tests ensure correctness and stability.
  • Few allocations due to extensive use of object pools.
  • API is fully annotated with nullability.
  • Dependency injection friendly. By default uses Microsoft.Extensions.DependencyInjection.
  • Supports configuration binding via Microsoft.Extensions.Configuration.
  • Support multiple S3 providers. See provider support further down for more info.
  • Support for uploading/downloading multiparts with parallel requests.
  • High-level API to help listing/deleting more than 1000 objects at the time. Uses HTTP pipelining to reduce latency.
  • Automatic pooling of requests to reduce allocations and speed up requests.

Usage

Download packages
  • AmazonS3
  • BackblazeB2
  • Google Cloud Storage
  • Wasabi

See the provider status page for the list of operations that are currently supported. For the purpose of the examples below, we are going to use the Amazon S3 provider.

Setup the config and client
AmazonS3Client client = new AmazonS3Client("MyKeyId", "MyAccessKey", AmazonS3Region.EuWest1)
Or use Microsoft's Dependency Injection
ServiceCollection services = new ServiceCollection();
services.AddAmazonS3(config => {
    config.Credentials = new StringAccessKey("MyKeyId", "MyAccessKey");
    config.Region = AmazonS3Region.EuWest1;
});

ServiceProvider provider = services.BuildServiceProvider();
AmazonS3Client client = provider.GetRequiredService<AmazonS3Client>();
Download/Upload using the Transfer API

The fluent Transfer API makes downloading/uploading objects easier by providing a convenient way of supplying information such as cache control, content-disposition, encryption keys, etc.

//Upload
IUpload upload = client.CreateUpload("MyBucket", "MyObject")
                        .WithAccessControl(ObjectCannedAcl.PublicReadWrite)
                        .WithCacheControl(CacheControlType.NoCache)
                        .WithEncryption();

PutObjectResponse putResp = await upload.UploadStringAsync("Hello World!");

//Download string
IDownload download = client.CreateDownload(bucketName, objectName)
                           .WithRange(0, 5);

GetObjectResponse getResp = await download.DownloadAsync();

Console.WriteLine(await dlResp.Content.AsStringAsync()); //Outputs "Hello"

Extensions

SimpleS3 is extensible and has multiple different network drivers and extensions you can use. Click on the extension below for more information.

If you are already using the SimpleS3.AmazonS3 package, you already have a dependency on most of the extensions below. These are only for advanced users that want to tweak their setup to their own liking.

Nuget Extension Description
NuGet HttpClient A network driver based on HttpClient
NuGet HttpClientFactory A network driver based on HttpClientFactory. It supports dynamic DNS changes.
NuGet HttpClientFactory.Polly Adds support for retry/timeout logic through Polly
NuGet ProfileManager A profile manager that can safely persist your credentials to disk
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Genbox.SimpleS3.Extensions.HttpClientFactory.Polly:

Package Downloads
Genbox.SimpleS3.ProviderBase

A simple, secure and high-performance library to communicate with Amazon S3 compatible APIs.

Genbox.SimpleS3.Cli.Core

A simple, secure and high-performance library to communicate with Amazon S3 compatible APIs.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.2.2 288 8/28/2024
3.2.1 314 8/24/2024
3.2.0 293 8/24/2024
3.1.1 440 8/21/2024
3.1.0 310 8/21/2024
3.0.1 665 4/21/2024
3.0.0 984 4/6/2023