Skip to content

Commit 0d150e9

Browse files
Upgrade supportedLifecycleRules definition
Use the values and "format" defined in arsenal, i.e. the names from S3. This simplifies code and avoids duplication. Issue: CLDSRV-651
1 parent bcae9d5 commit 0d150e9

3 files changed

Lines changed: 5 additions & 14 deletions

File tree

constants.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,6 @@ const constants = {
250250
// if requester is not bucket owner, bucket policy actions should be denied with
251251
// MethodNotAllowed error
252252
onlyOwnerAllowed: ['bucketDeletePolicy', 'bucketGetPolicy', 'bucketPutPolicy'],
253-
supportedLifecycleRules: [
254-
'expiration',
255-
'noncurrentVersionExpiration',
256-
'abortIncompleteMultipartUpload',
257-
'transitions',
258-
'noncurrentVersionTransition',
259-
],
260253
};
261254

262255
module.exports = constants;

lib/Config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ const {
1818
base64Regex,
1919
allowedUtapiEventFilterFields,
2020
allowedUtapiEventFilterStates,
21-
supportedLifecycleRules,
2221
} = require('../constants');
22+
const { ValidLifecycleRules: supportedLifecycleRules } = require('arsenal').models;
2323
const { utapiVersion } = require('utapi');
2424
const { scaleMsPerDay } = s3middleware.objectUtils;
2525

tests/unit/Config.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ const {
99
ConfigObject,
1010
} = require('../../lib/Config');
1111

12-
const {
13-
supportedLifecycleRules,
14-
} = require('../../constants');
12+
const { ValidLifecycleRules: supportedLifecycleRules } = require('arsenal').models;
1513

1614
describe('Config', () => {
1715
const envToRestore = [];
@@ -673,9 +671,9 @@ describe('Config', () => {
673671

674672
it('should return the rules provided when they are valid', () => {
675673
const rules = [
676-
'expiration',
677-
'noncurrentVersionExpiration',
678-
'abortIncompleteMultipartUpload',
674+
'Expiration',
675+
'NoncurrentVersionExpiration',
676+
'AbortIncompleteMultipartUpload',
679677
];
680678
const parsedRules = parseSupportedLifecycleRules(rules);
681679
assert.deepStrictEqual(parsedRules, rules);

0 commit comments

Comments
 (0)