Issue
Location: C:\git\ModularPipelines\src\ModularPipelines.AmazonWebServices\S3.cs (lines 10-15)
Problem:
The S3 class exposes the underlying AmazonS3Client directly through a public property. This violates encapsulation and allows callers to bypass any wrapper methods, logging, or future enhancements.
Current code:
public class S3
{
public AmazonS3Client Client { get; } // Publicly exposed!
public S3(AmazonS3Client client)
{
Client = client;
}
// ... wrapper methods
}
Issues:
- Callers can use Client directly, bypassing wrapper methods
- Cannot add cross-cutting concerns (logging, metrics, validation) to all S3 operations
- No abstraction - tied directly to AWS SDK types
- Difficult to mock for testing
Risk: LOW - This is a design smell rather than a bug.
Suggested Fix:
Option 1: Make the client internal or private:
internal AmazonS3Client Client { get; }
Option 2: Extract an interface and hide the implementation:
public interface IS3
{
Task Bucket(PutBucketRequest request, CancellationToken token = default);
// ... other methods
}
Option 3: If public access is intentional, document it clearly:
///
/// The underlying AWS S3 client. Use for operations not yet wrapped by this class.
/// Note: Direct usage bypasses any framework-level logging or error handling.
///
public AmazonS3Client Client { get; }