Genbox / SimpleS3

A .NET Core implementation of Amazon's S3 API with focus on simplicity, security and performance
MIT License
48 stars 8 forks source link

Support GCS #47

Closed mike-csis closed 3 years ago

mike-csis commented 3 years ago

Describe the feature Google Clouds Storage, GCS, also has an S3 compatible API, but it requires some tweaking to be supported by SimpleS3.

I have made the following work:

            ServiceCollection services = new ServiceCollection();
            services.AddAmazonS3(config =>
            {
                config.Credentials = new StringAccessKey("GOOG...", "IjqO...");
                config.RegionCode = "eu";
                config.Endpoint = new Uri("https://storage.googleapis.com");
                config.NamingMode = NamingMode.PathStyle;
            });

            var service = services.First(s => s.ImplementationType?.Name == "ChunkedContentRequestStreamWrapper");
            services.Remove(service);

            ServiceProvider provider = services.BuildServiceProvider();
            AmazonS3Client client = provider.GetRequiredService<AmazonS3Client>();

Notes:

Genbox commented 3 years ago

They have both virtual and path style naming documented here: https://cloud.google.com/storage/docs/request-endpoints#xml-api

Genbox commented 3 years ago

I've tested virtual and path style naming and it seems to work. I could not find any docs on support for streamed chunking, so I've disabled it by default by setting PayloadSignatureMode = SignatureMode.FullSignature; - which is the same as removing the ChunkedContentRequestStreamWrapper service.

Genbox commented 3 years ago

GCS is now implemented and unit tested via the new cross-provider tests.