-
Notifications
You must be signed in to change notification settings - Fork 266
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EAM: Add AWS credentials validation (#821)
* Add AWS credentials validation * Add changelog
- Loading branch information
1 parent
54901f8
commit 43d7e47
Showing
4 changed files
with
105 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"saleor-app-products-feed": patch | ||
--- | ||
|
||
Added validation for AWS credentials. If provided configuration for S3 Bucket is invalid, it won't be saved. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
apps/products-feed/src/modules/file-storage/s3/check-bucket-access.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { HeadBucketCommand, S3Client } from "@aws-sdk/client-s3"; | ||
|
||
interface checkBucketAccessArgs { | ||
s3Client: S3Client; | ||
bucketName: string; | ||
} | ||
|
||
// Check if client can access the bucket. Throws an error otherwise | ||
export const checkBucketAccess = async ({ s3Client, bucketName }: checkBucketAccessArgs) => { | ||
await s3Client.send( | ||
new HeadBucketCommand({ | ||
Bucket: bucketName, | ||
}) | ||
); | ||
}; |