Compare commits

...

2 Commits

4 changed files with 112 additions and 96 deletions

View File

@ -20,8 +20,7 @@
"homepage": "https://github.com/scality/S3#readme",
"dependencies": {
"@hapi/joi": "^17.1.0",
"agentkeepalive": "^4.1.3",
"arsenal": "github:scality/Arsenal#a8df2b7",
"arsenal": "github:scality/Arsenal#048e8b0",
"async": "~2.5.0",
"aws-sdk": "2.905.0",
"azure-storage": "^2.1.0",

View File

@ -18,17 +18,26 @@ const mockLegalHold = {
on: { Status: 'ON' },
};
function createLegalHoldParams(bucket, key, status) {
function createLegalHoldParams(bucket, key, status, versionId) {
const params = { Bucket: bucket, Key: key };
if (!status) {
return { Bucket: bucket, Key: key };
return params;
}
return {
Bucket: bucket,
Key: key,
if (!versionId) {
Object.assign(params, {
VersionId: versionId,
LegalHold: {
Status: status,
},
});
return params;
}
Object.assign(params, {
LegalHold: {
Status: status,
},
};
});
return params;
}
const isCEPH = process.env.CI_CEPH !== undefined;
@ -171,5 +180,13 @@ describeSkipIfCeph('PUT object legal hold', () => {
changeObjectLock([{ bucket, key, versionId }], '', done);
});
});
it('should support request with versionId parameter', done => {
const params = createLegalHoldParams(bucket, key, 'ON', versionId);
s3.putObjectLegalHold(params, err => {
assert.ifError(err);
changeObjectLock([{ bucket, key, versionId }], '', done);
});
});
});
});

View File

@ -128,5 +128,19 @@ describeSkipIfCeph('PUT object retention', () => {
{ bucket: bucketName, key: objectName, versionId }], '', done);
});
});
it('should support request with versionId parameter', done => {
s3.putObjectRetention({
Bucket: bucketName,
Key: objectName,
Retention: retentionConfig,
VersionId: versionId,
}, err => {
assert.ifError(err);
changeObjectLock([
{ bucket: bucketName, key: objectName, versionId },
], '', done);
});
});
});
});

162
yarn.lock
View File

@ -109,7 +109,7 @@
resolved "https://registry.yarnpkg.com/@octetstream/promisify/-/promisify-2.0.2.tgz#29ac3bd7aefba646db670227f895d812c1a19615"
integrity sha512-7XHoRB61hxsz8lBQrjC1tq/3OEIgpvGWg6DKAdwi7WRzruwkmsdwmOoUXbU4Dtd4RSOMDwed0SkP3y8UlMt1Bg==
"@senx/warp10@^1.0.14":
"@senx/warp10@^1.0.10":
version "1.0.14"
resolved "https://registry.yarnpkg.com/@senx/warp10/-/warp10-1.0.14.tgz#9a25007786b3dbc050f9a545a88291a6180fff8f"
integrity sha512-dfYDNLoOiRx8crnO/y39wNSjEVkiBRdWO2Vj2ClTXBz2b/4ozI0xfThN3bPZuX27oiLIJQRno2lJ73DZ00Gutg==
@ -690,9 +690,9 @@ arraybuffer.slice@~0.0.7:
resolved "https://registry.yarnpkg.com/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz#3bbc4275dd584cc1b10809b89d4e8b63a69e7675"
integrity sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog==
"arsenal@github:scality/Arsenal#a8df2b7":
"arsenal@github:scality/Arsenal#048e8b0":
version "8.2.1"
resolved "https://codeload.github.com/scality/Arsenal/tar.gz/a8df2b7b96beb52290fbb8d827c0bc874574c21d"
resolved "https://codeload.github.com/scality/Arsenal/tar.gz/048e8b02bc42a65fb5ba0a0da86ea030b9aa4e34"
dependencies:
"@hapi/joi" "^15.1.0"
JSONStream "^1.0.0"
@ -751,32 +751,6 @@ arsenal@scality/Arsenal#580e25a:
optionalDependencies:
ioctl "2.0.0"
arsenal@scality/Arsenal#65966f5:
version "7.7.0"
resolved "https://codeload.github.com/scality/Arsenal/tar.gz/65966f5ddf93b048906d14a8c26056abfd4c22ba"
dependencies:
"@hapi/joi" "^15.1.0"
JSONStream "^1.0.0"
agentkeepalive "^4.1.3"
ajv "6.12.2"
async "~2.1.5"
debug "~2.6.9"
diskusage "^1.1.1"
ioredis "4.9.5"
ipaddr.js "1.9.1"
level "~5.0.1"
level-sublevel "~6.6.5"
node-forge "^0.7.1"
simple-glob "^0.2"
socket.io "~2.3.0"
socket.io-client "~2.3.0"
utf8 "2.1.2"
uuid "^3.0.1"
werelogs scality/werelogs#0ff7ec82
xml2js "~0.4.23"
optionalDependencies:
ioctl "2.0.0"
arsenal@scality/Arsenal#8ed8478:
version "8.2.1"
resolved "https://codeload.github.com/scality/Arsenal/tar.gz/8ed84786fce31f603b1e8cd641b3b44b8f715b0b"
@ -812,6 +786,31 @@ arsenal@scality/Arsenal#8ed8478:
optionalDependencies:
ioctl "2.0.1"
arsenal@scality/Arsenal#aa9c9e5:
version "7.7.0"
resolved "https://codeload.github.com/scality/Arsenal/tar.gz/aa9c9e54ff27211131ec823a34a3d8d77dc55cf2"
dependencies:
"@hapi/joi" "^15.1.0"
JSONStream "^1.0.0"
ajv "6.12.2"
async "~2.1.5"
debug "~2.6.9"
diskusage "^1.1.1"
ioredis "4.9.5"
ipaddr.js "1.9.1"
level "~5.0.1"
level-sublevel "~6.6.5"
node-forge "^0.7.1"
simple-glob "^0.2"
socket.io "~2.3.0"
socket.io-client "~2.3.0"
utf8 "2.1.2"
uuid "^3.0.1"
werelogs scality/werelogs#0ff7ec82
xml2js "~0.4.23"
optionalDependencies:
ioctl "2.0.0"
arsenal@scality/Arsenal#c57cde8:
version "8.1.4"
resolved "https://codeload.github.com/scality/Arsenal/tar.gz/c57cde88bb04fe9803ec08c3a883f6eb986e4149"
@ -1345,9 +1344,9 @@ bucketclient@scality/bucketclient#949f11a:
version "8.1.0"
resolved "https://codeload.github.com/scality/bucketclient/tar.gz/949f11a6a39003439f97bae6dfb86f5da07fbfb0"
dependencies:
arsenal scality/Arsenal#c57cde8
agentkeepalive "^4.1.3"
arsenal scality/Arsenal#8ed8478
werelogs scality/werelogs#351a2a3
yarn "^1.17.3"
buffer-alloc-unsafe@^1.1.0:
version "1.1.0"
@ -1425,11 +1424,6 @@ busboy@^0.2.11:
dicer "0.2.5"
readable-stream "1.1.x"
byte-size@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/byte-size/-/byte-size-7.0.0.tgz#36528cd1ca87d39bd9abd51f5715dc93b6ceb032"
integrity sha512-NNiBxKgxybMBtWdmvx7ZITJi4ZG+CYUgwOSZTfqB1qogkRHrhbQE/R2r5Fh94X+InN5MCYz6SvB/ejHMj/HbsQ==
bytes@3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6"
@ -1830,7 +1824,12 @@ core-util-is@1.0.2, core-util-is@~1.0.0:
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=
cron-parser@^2.11.0, cron-parser@^2.15.0, cron-parser@^2.18.0:
cron-parser@1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/cron-parser/-/cron-parser-1.1.0.tgz#075b84c459c155e8c482ab4d56aff99dae58352e"
integrity sha1-B1uExFnBVejEgqtNVq/5na5YNS4=
cron-parser@^2.11.0, cron-parser@^2.15.0:
version "2.18.0"
resolved "https://registry.yarnpkg.com/cron-parser/-/cron-parser-2.18.0.tgz#de1bb0ad528c815548371993f81a54e5a089edcf"
integrity sha512-s4odpheTyydAbTBQepsqd2rNWGa2iV3cyo8g7zbI2QQYGLVsfbhmwukayS1XHppe02Oy1fg7mg6xoaraVJeEcg==
@ -2077,7 +2076,7 @@ diff@^4.0.1, diff@^4.0.2:
resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d"
integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==
diskusage@1.1.3, diskusage@^1.1.1, diskusage@^1.1.3:
diskusage@1.1.3, diskusage@^1.1.1:
version "1.1.3"
resolved "https://registry.yarnpkg.com/diskusage/-/diskusage-1.1.3.tgz#680d7dbf1b679168a195c9240eb3552cbd2c067b"
integrity sha512-EAyaxl8hy4Ph07kzlzGTfpbZMNAAAHXSZtNEMwdlnSd1noHzvA6HsgKt4fEMSvaEXQYLSphe5rPMxN4WOj0hcQ==
@ -2944,11 +2943,6 @@ functional-red-black-tree@^1.0.1, functional-red-black-tree@~1.0.1:
resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327"
integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=
gar@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/gar/-/gar-1.0.4.tgz#f777bc7db425c0572fdeb52676172ca1ae9888b8"
integrity sha512-w4n9cPWyP7aHxKxYHFQMegj7WIAsL/YX/C4Bs5Rr8s1H9M1rNtRWRsw+ovYMkXDQ5S4ZbYHsHAPmevPjPgw44w==
gauge@~2.7.3:
version "2.7.4"
resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7"
@ -2996,14 +2990,6 @@ generate-object-property@^1.1.0:
dependencies:
is-property "^1.0.0"
get-folder-size@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/get-folder-size/-/get-folder-size-2.0.1.tgz#3fe0524dd3bad05257ef1311331417bcd020a497"
integrity sha512-+CEb+GDCM7tkOS2wdMKTn9vU7DgnKUTuDlehkNJKNSovdCOVxs14OfKCk4cvSaR3za4gj+OBdl9opPN9xrJ0zA==
dependencies:
gar "^1.0.4"
tiny-each-async "2.0.3"
get-intrinsic@^1.0.0, get-intrinsic@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.0.2.tgz#6820da226e50b24894e08859469dc68361545d49"
@ -4632,10 +4618,10 @@ lolex@^1.4.0:
resolved "https://registry.yarnpkg.com/lolex/-/lolex-1.6.0.tgz#3a9a0283452a47d7439e72731b9e07d7386e49f6"
integrity sha1-OpoCg0UqR9dDnnJzG54H1zhuSfY=
long-timeout@0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/long-timeout/-/long-timeout-0.1.1.tgz#9721d788b47e0bcb5a24c2e2bee1a0da55dab514"
integrity sha1-lyHXiLR+C8taJMLivuGg2lXatRQ=
long-timeout@0.0.2:
version "0.0.2"
resolved "https://registry.yarnpkg.com/long-timeout/-/long-timeout-0.0.2.tgz#f36449ba89629d13a7a2b2523a4db9dd66e3ff68"
integrity sha1-82RJuolinROnorJSOk253Wbj/2g=
long@^4.0.0:
version "4.0.0"
@ -5157,6 +5143,14 @@ node-abi@^2.2.0:
dependencies:
semver "^5.4.1"
node-cron@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/node-cron/-/node-cron-2.0.3.tgz#b9649784d0d6c00758410eef22fa54a10e3f602d"
integrity sha512-eJI+QitXlwcgiZwNNSRbqsjeZMp5shyajMR81RZCqeW0ZDEj4zU9tpd4nTh/1JsBiKbF8d08FCewiipDmVIYjg==
dependencies:
opencollective-postinstall "^2.0.0"
tz-offset "0.0.1"
node-fetch@^2.3.0:
version "2.6.1"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052"
@ -5186,14 +5180,13 @@ node-mocks-http@1.5.2:
mime "^1.3.4"
type-is "^1.6.4"
node-schedule@^1.3.2:
version "1.3.3"
resolved "https://registry.yarnpkg.com/node-schedule/-/node-schedule-1.3.3.tgz#f8e01c5fb9597f09ecf9c4c25d6938e5e7a06f48"
integrity sha512-uF9Ubn6luOPrcAYKfsXWimcJ1tPFtQ8I85wb4T3NgJQrXazEzojcFZVk46ZlLHby3eEJChgkV/0T689IsXh2Gw==
node-schedule@1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/node-schedule/-/node-schedule-1.2.0.tgz#f03d4ebe71b0573e1708ddae0aa45d1658450cf1"
integrity sha1-8D1OvnGwVz4XCN2uCqRdFlhFDPE=
dependencies:
cron-parser "^2.18.0"
long-timeout "0.1.1"
sorted-array-functions "^1.3.0"
cron-parser "1.1.0"
long-timeout "0.0.2"
node-uuid@~1.4.0, node-uuid@~1.4.7:
version "1.4.8"
@ -7010,11 +7003,6 @@ socks@~2.3.2:
ip "1.1.5"
smart-buffer "^4.1.0"
sorted-array-functions@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/sorted-array-functions/-/sorted-array-functions-1.3.0.tgz#8605695563294dffb2c9796d602bd8459f7a0dd5"
integrity sha512-2sqgzeFlid6N4Z2fUQ1cvFmTOLRi/sEDzSQ0OKYchqgoPmQBVyM3959qYx3fpS6Esef80KjmpgPeEr028dP3OA==
source-map-support@^0.5.11, source-map-support@^0.5.19, source-map-support@^0.5.7:
version "0.5.19"
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61"
@ -7442,11 +7430,6 @@ thunkify@^2.1.2:
resolved "https://registry.yarnpkg.com/thunkify/-/thunkify-2.1.2.tgz#faa0e9d230c51acc95ca13a361ac05ca7e04553d"
integrity sha1-+qDp0jDFGsyVyhOjYawFyn4EVT0=
tiny-each-async@2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/tiny-each-async/-/tiny-each-async-2.0.3.tgz#8ebbbfd6d6295f1370003fbb37162afe5a0a51d1"
integrity sha1-jru/1tYpXxNwAD+7NxYq/loKUdE=
tmp@0.0.33, tmp@^0.0.33:
version "0.0.33"
resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9"
@ -7687,6 +7670,11 @@ typewiselite@~1.0.0:
resolved "https://registry.yarnpkg.com/typewiselite/-/typewiselite-1.0.0.tgz#c8882fa1bb1092c06005a97f34ef5c8508e3664e"
integrity sha1-yIgvobsQksBgBal/NO9chQjjZk4=
tz-offset@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/tz-offset/-/tz-offset-0.0.1.tgz#fef920257024d3583ed9072a767721a18bdb8a76"
integrity sha512-kMBmblijHJXyOpKzgDhKx9INYU4u4E1RPMB0HqmKSgWG8vEcf3exEfLh4FFfzd3xdQOw9EuIy/cP0akY6rHopQ==
uc.micro@^1.0.1, uc.micro@^1.0.5:
version "1.0.6"
resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.6.tgz#9c411a802a409a91fc6cf74081baba34b24499ac"
@ -7770,23 +7758,21 @@ utapi@scality/utapi#357f8fe:
resolved "https://codeload.github.com/scality/utapi/tar.gz/357f8fe1e410b49742c717dc5ea4699c68c399ba"
dependencies:
"@hapi/joi" "^17.1.1"
"@senx/warp10" "^1.0.14"
arsenal scality/Arsenal#65966f5
"@senx/warp10" "^1.0.10"
arsenal scality/Arsenal#aa9c9e5
async "^3.2.0"
aws4 "^1.8.0"
body-parser "^1.19.0"
bucketclient scality/bucketclient
byte-size "^7.0.0"
commander "^5.1.0"
cron-parser "^2.15.0"
diskusage "^1.1.3"
express "^4.17.1"
get-folder-size "^2.0.1"
ioredis "^4.9.5"
js-yaml "^3.14.0"
level-mem "^5.0.1"
needle "^2.5.0"
node-schedule "^1.3.2"
node-cron "^2.0.3"
node-schedule "1.2.0"
oas-tools "^2.1.8"
uuid "^3.3.2"
vaultclient scality/vaultclient#ff9e92f
@ -7886,6 +7872,16 @@ vary@~1.1.2:
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=
vaultclient@scality/vaultclient#ac3cd70:
version "7.5.1"
resolved "https://codeload.github.com/scality/vaultclient/tar.gz/ac3cd706c4aa799e6ba6a66276728c7b9bc5f034"
dependencies:
agentkeepalive "^4.1.3"
arsenal scality/Arsenal#580e25a
commander "2.20.0"
werelogs scality/werelogs#4e0d97c
xml2js "0.4.19"
vaultclient@scality/vaultclient#e1c0044:
version "8.1.1"
resolved "https://codeload.github.com/scality/vaultclient/tar.gz/e1c00445ab2633c28a016db0094a686518f14566"
@ -7895,16 +7891,6 @@ vaultclient@scality/vaultclient#e1c0044:
werelogs scality/werelogs#4e0d97c
xml2js "0.4.19"
vaultclient@scality/vaultclient#ff9e92f:
version "7.5.1"
resolved "https://codeload.github.com/scality/vaultclient/tar.gz/ff9e92fd8e35c16bbc20f5e4ee0531d8bffedbf2"
dependencies:
agentkeepalive "^4.1.3"
arsenal scality/Arsenal#580e25a
commander "2.20.0"
werelogs scality/werelogs#4e0d97c
xml2js "0.4.19"
verror@1.10.0:
version "1.10.0"
resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400"