Skip to content

Commit d8b3379

Browse files
Fix build.
1 parent 430c100 commit d8b3379

3 files changed

Lines changed: 6 additions & 26 deletions

File tree

src/ImageSharp.Web.Providers.AWS/Factories/AWSS3Factory.cs renamed to src/ImageSharp.Web.Providers.AWS/AmazonS3ClientFactory.cs

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,22 @@
22
// Licensed under the Apache License, Version 2.0.
33

44
using System;
5-
using System.Globalization;
6-
using System.Threading;
7-
using System.Threading.Tasks;
85
using Amazon;
96
using Amazon.S3;
10-
using Amazon.S3.Model;
11-
using SixLabors.ImageSharp.Web.Caching.AWS;
127
using SixLabors.ImageSharp.Web.Providers.AWS;
138

14-
namespace SixLabors.ImageSharp.Web.Factories
9+
namespace SixLabors.ImageSharp.Web
1510
{
16-
internal class AWSS3Factory
11+
internal static class AmazonS3ClientFactory
1712
{
1813
/// <summary>
1914
/// Creates a new bucket under the specified account if a bucket
2015
/// with the same name does not already exist.
2116
/// </summary>
2217
/// <param name="options">The AWS S3 Storage cache options.</param>
23-
/// <param name="acl">
24-
/// Specifies whether data in the bucket may be accessed publicly and the level of access.
25-
/// <see cref="S3CannedACL.PublicRead"/> specifies full public read access for bucket
26-
/// and object data. <see cref="S3CannedACL.Private"/> specifies that the bucket
27-
/// data is private to the account owner.
28-
/// </param>
2918
/// <returns>
30-
/// If the bucket does not already exist, a <see cref="PutBucketResponse"/> describing the newly
31-
/// created bucket. If the container already exists, <see langword="null"/>.
19+
/// A new <see cref="AmazonS3Client"/>.
3220
/// </returns>
33-
3421
public static AmazonS3Client CreateClient(AWSS3BucketClientOptions options)
3522
{
3623
if (!string.IsNullOrWhiteSpace(options.Endpoint))

src/ImageSharp.Web.Providers.AWS/Caching/AWSS3StorageCache.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@
77
using System.IO;
88
using System.Threading;
99
using System.Threading.Tasks;
10-
using Amazon;
1110
using Amazon.S3;
1211
using Amazon.S3.Model;
1312
using Microsoft.Extensions.Options;
14-
using SixLabors.ImageSharp.Web.Factories;
1513
using SixLabors.ImageSharp.Web.Providers.AWS;
1614
using SixLabors.ImageSharp.Web.Resolvers;
1715
using SixLabors.ImageSharp.Web.Resolvers.AWS;
@@ -28,7 +26,6 @@ public class AWSS3StorageCache : IImageCache
2826
TaskCreationOptions.None,
2927
TaskContinuationOptions.None,
3028
TaskScheduler.Default);
31-
private static readonly AWSS3Factory AWSS3Factory = new ();
3229

3330
private readonly IAmazonS3 amazonS3Client;
3431
private readonly string bucket;
@@ -42,7 +39,7 @@ public AWSS3StorageCache(IOptions<AWSS3BucketClientOptions> cacheOptions)
4239
Guard.NotNull(cacheOptions, nameof(cacheOptions));
4340
AWSS3BucketClientOptions options = cacheOptions.Value;
4441
this.bucket = options.BucketName;
45-
this.amazonS3Client = AWSS3Factory.CreateClient(options);
42+
this.amazonS3Client = AmazonS3ClientFactory.CreateClient(options);
4643
}
4744

4845
/// <inheritdoc/>
@@ -101,7 +98,7 @@ public static PutBucketResponse CreateIfNotExists(
10198
AWSS3BucketClientOptions options,
10299
S3CannedACL acl)
103100
{
104-
AmazonS3Client client = AWSS3Factory.CreateClient(options);
101+
AmazonS3Client client = AmazonS3ClientFactory.CreateClient(options);
105102

106103
bool foundBucket = false;
107104
ListBucketsResponse listBucketsResponse = RunSync(() => client.ListBucketsAsync());

src/ImageSharp.Web.Providers.AWS/Providers/AWSS3StorageImageProvider.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@
44
using System;
55
using System.Collections.Generic;
66
using System.Threading.Tasks;
7-
using Amazon;
87
using Amazon.S3;
98
using Amazon.S3.Model;
109
using Microsoft.AspNetCore.Http;
1110
using Microsoft.AspNetCore.Http.Extensions;
1211
using Microsoft.Extensions.Options;
13-
using SixLabors.ImageSharp.Web.Factories;
1412
using SixLabors.ImageSharp.Web.Resolvers;
1513
using SixLabors.ImageSharp.Web.Resolvers.AWS;
1614

@@ -21,8 +19,6 @@ namespace SixLabors.ImageSharp.Web.Providers.AWS
2119
/// </summary>
2220
public class AWSS3StorageImageProvider : IImageProvider
2321
{
24-
private static readonly AWSS3Factory AWSS3Factory = new();
25-
2622
/// <summary>
2723
/// Character array to remove from paths.
2824
/// </summary>
@@ -57,7 +53,7 @@ public AWSS3StorageImageProvider(IOptions<AWSS3StorageImageProviderOptions> stor
5753

5854
foreach (AWSS3BucketClientOptions bucket in this.storageOptions.S3Buckets)
5955
{
60-
this.buckets.Add(bucket.BucketName, AWSS3Factory.CreateClient(bucket));
56+
this.buckets.Add(bucket.BucketName, AmazonS3ClientFactory.CreateClient(bucket));
6157
}
6258
}
6359

0 commit comments

Comments
 (0)