From 0d50930be9f31ae1d8bcffdc9d842e7988936347 Mon Sep 17 00:00:00 2001 From: Etienne Noel Date: Fri, 15 Sep 2023 08:38:50 -0700 Subject: [PATCH] - Improved the S3Client. --- packages/aws/src/clients/s3.client.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/aws/src/clients/s3.client.ts b/packages/aws/src/clients/s3.client.ts index 00d7b5fd7..4ad475590 100644 --- a/packages/aws/src/clients/s3.client.ts +++ b/packages/aws/src/clients/s3.client.ts @@ -3,7 +3,7 @@ import { LogHandlerInterface } from "@pristine-ts/logging"; import { moduleScoped, tag } from "@pristine-ts/common"; import { AwsModuleKeyname } from "../aws.module.keyname"; import { S3ClientInterface } from "../interfaces/s3-client.interface"; -import { GetObjectCommand, GetObjectCommandOutput, ListObjectsCommand, ListObjectsCommandOutput, PutObjectCommand, S3Client as AWSS3Client } from "@aws-sdk/client-s3"; +import { GetObjectCommand, GetObjectCommandOutput, ListObjectsCommand, ListObjectsCommandOutput, PutObjectCommand, S3Client as AWSS3Client, S3ClientConfig } from "@aws-sdk/client-s3"; import { S3PresignedOperationTypeEnum } from "../enums/s3-presigned-operation-type.enum"; import { getSignedUrl } from "@aws-sdk/s3-request-presigner"; @@ -40,6 +40,14 @@ export class S3Client implements S3ClientInterface { return this.client = this.client ?? new AWSS3Client({region: this.region}); } + /** + * Allows you to manually set the config if needed. + * @param config + */ + setClient(config: S3ClientConfig) { + this.client = new AWSS3Client(config); + } + /** * Gets an object and all its details from S3. * @param bucketName The bucket name where to get the object.