|
1 | 1 | const assert = require('assert'); |
2 | | -const async = require('async'); |
| 2 | + |
| 3 | +const { |
| 4 | + S3Client, |
| 5 | + CreateBucketCommand, |
| 6 | + DeleteBucketCommand, |
| 7 | + PutBucketWebsiteCommand, |
| 8 | + PutObjectCommand, |
| 9 | + DeleteObjectCommand, |
| 10 | + PutBucketPolicyCommand, |
| 11 | +} = require('@aws-sdk/client-s3'); |
3 | 12 | const fs = require('fs'); |
4 | 13 | const path = require('path'); |
5 | | - |
6 | | -const { S3 } = require('aws-sdk'); |
| 14 | +const async = require('async'); |
7 | 15 |
|
8 | 16 | const conf = require('../../../../../lib/Config').config; |
9 | 17 | const getConfig = require('../support/config'); |
10 | 18 | const { makeRequest } = require('../../../raw-node/utils/makeRequest'); |
11 | 19 | const { WebsiteConfigTester } = require('../../lib/utility/website-util'); |
12 | 20 |
|
13 | | -const config = getConfig('default', { signatureVersion: 'v4' }); |
14 | | -const s3 = new S3(config); |
| 21 | +const config = getConfig('default'); |
| 22 | +const s3Client = new S3Client(config); |
| 23 | +const s3 = { |
| 24 | + createBucket: (params, cb) => { |
| 25 | + s3Client.send(new CreateBucketCommand(params)).then(d => cb(null, d)).catch(cb); |
| 26 | + }, |
| 27 | + deleteBucket: (params, cb) => { |
| 28 | + s3Client.send(new DeleteBucketCommand(params)).then(d => cb(null, d)).catch(cb); |
| 29 | + }, |
| 30 | + putBucketWebsite: (params, cb) => { |
| 31 | + s3Client.send(new PutBucketWebsiteCommand(params)).then(d => cb(null, d)).catch(cb); |
| 32 | + }, |
| 33 | + putObject: (params, cb) => { |
| 34 | + s3Client.send(new PutObjectCommand(params)).then(d => cb(null, d)).catch(cb); |
| 35 | + }, |
| 36 | + deleteObject: (params, cb) => { |
| 37 | + s3Client.send(new DeleteObjectCommand(params)).then(d => cb(null, d)).catch(cb); |
| 38 | + }, |
| 39 | + putBucketPolicy: (params, cb) => { |
| 40 | + s3Client.send(new PutBucketPolicyCommand(params)).then(d => cb(null, d)).catch(cb); |
| 41 | + }, |
| 42 | +}; |
15 | 43 |
|
16 | 44 | const transport = conf.https ? 'https' : 'http'; |
17 | 45 | const bucket = process.env.AWS_ON_AIR ? 'awsbucketwebsitetester' : |
|
0 commit comments