@@ -44,13 +44,13 @@ const BODY = "BODY";
4444const EXPIRATION = 60 * 60 * 1000 ;
4545
4646// Create Amazon S3 client object
47- const v3Client = new S3 ( { region : REGION } ) ;
47+ const v3Client = new S3 ( { region :REGION } ) ;
4848
4949const run = async ( ) => {
5050 try {
5151 //Create an S3 bucket
5252 console . log ( `Creating bucket ${ BUCKET } ` ) ;
53- await v3Client . send ( new CreateBucketCommand ( BUCKET ) ) ;
53+ await v3Client . send ( new CreateBucketCommand ( { Bucket : BUCKET } ) ) ;
5454 console . log ( `Waiting for "${ BUCKET } " bucket creation...` ) ;
5555 } catch ( err ) {
5656 console . log ( "Error creating bucket" , err ) ;
@@ -61,9 +61,9 @@ const run = async () => {
6161 // Create request
6262 const request =
6363 await createRequest (
64- v3Client ,
65- new PutObjectCommand ( { KEY , BUCKET } )
66- ) ;
64+ v3Client ,
65+ new PutObjectCommand ( { Key : KEY , Bucket : BUCKET } )
66+ ) ;
6767 // Define the duration until expiration of the presigned URL
6868 const expiration = new Date ( Date . now ( ) + EXPIRATION ) ;
6969
@@ -91,14 +91,14 @@ const run = async () => {
9191 try {
9292 // Delete the object
9393 console . log ( `\nDeleting object "${ KEY } " from bucket` ) ;
94- await v3Client . send ( new DeleteObjectCommand ( BUCKET , KEY ) ) ;
94+ await v3Client . send ( new DeleteObjectCommand ( { Bucket : BUCKET , Key : KEY } ) ) ;
9595 } catch ( err ) {
9696 console . log ( "Error deleting object" , err ) ;
9797 }
9898 try {
9999 // Delete the bucket
100100 console . log ( `\nDeleting bucket ${ BUCKET } ` ) ;
101- await v3Client . send ( new DeleteBucketCommand ( BUCKET ) ) ;
101+ await v3Client . send ( new DeleteBucketCommand ( { Bucket : BUCKET } ) ) ;
102102 } catch ( err ) {
103103 console . log ( "Error deleting bucket" , err ) ;
104104 }
0 commit comments