Skip to content

Commit

Permalink
Merge pull request #578 from magieno/improve-the-aws-clients
Browse files Browse the repository at this point in the history
- Improved the S3Client.
  • Loading branch information
etiennenoel authored Sep 15, 2023
2 parents a8cede6 + 0d50930 commit 1edbb26
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/aws/src/clients/s3.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 1edbb26

Please sign in to comment.