22'use strict' ;
33
44const _ = require ( 'lodash' ) ;
5- const { S3 } = require ( '@aws-sdk/client-s3' ) ;
65
76const config = require ( '../../../config' ) ;
87const P = require ( '../../util/promise' ) ;
@@ -13,10 +12,9 @@ const size_utils = require('../../util/size_utils');
1312const BlockStoreBase = require ( './block_store_base' ) . BlockStoreBase ;
1413const { RpcError } = require ( '../../rpc' ) ;
1514const { NodeHttpHandler } = require ( "@smithy/node-http-handler" ) ;
15+ const noobaa_s3_client = require ( '../../sdk/noobaa_s3_client/noobaa_s3_client' ) ;
1616
1717
18- const DEFAULT_REGION = 'us-east-1' ;
19-
2018class BlockStoreS3 extends BlockStoreBase {
2119
2220 constructor ( options ) {
@@ -40,14 +38,14 @@ class BlockStoreS3 extends BlockStoreBase {
4038 RoleSessionName : 'block_store_operations'
4139 } ;
4240 } else {
43- this . s3cloud = new S3 ( {
41+ this . s3cloud = noobaa_s3_client . get_s3_client_v3_params ( {
4442 endpoint : endpoint ,
4543 credentials : {
4644 accessKeyId : this . cloud_info . access_keys . access_key . unwrap ( ) ,
4745 secretAccessKey : this . cloud_info . access_keys . secret_key . unwrap ( ) ,
4846 } ,
4947 forcePathStyle : true ,
50- region : DEFAULT_REGION ,
48+ region : config . DEFAULT_REGION ,
5149 requestHandler : new NodeHttpHandler ( {
5250 httpsAgent : http_utils . get_default_agent ( endpoint )
5351 } ) ,
@@ -58,13 +56,14 @@ class BlockStoreS3 extends BlockStoreBase {
5856 config . EXPERIMENTAL_DISABLE_S3_COMPATIBLE_DELEGATION . DEFAULT ;
5957 this . disable_metadata = config . EXPERIMENTAL_DISABLE_S3_COMPATIBLE_METADATA [ this . cloud_info . endpoint_type ] ||
6058 config . EXPERIMENTAL_DISABLE_S3_COMPATIBLE_METADATA . DEFAULT ;
61- this . s3cloud = new S3 ( {
59+ this . s3cloud = noobaa_s3_client . get_s3_client_v3_params ( {
6260 endpoint : endpoint ,
6361 forcePathStyle : true ,
6462 credentials : {
6563 accessKeyId : this . cloud_info . access_keys . access_key . unwrap ( ) ,
6664 secretAccessKey : this . cloud_info . access_keys . secret_key . unwrap ( ) ,
6765 } ,
66+ region : config . DEFAULT_REGION ,
6867 applyChecksum : cloud_utils . disable_s3_compatible_bodysigning ( endpoint ) ,
6968 requestHandler : new NodeHttpHandler ( {
7069 httpsAgent : http_utils . get_unsecured_agent ( endpoint )
0 commit comments