* bucketGetObjectLock - Return object lock configuration for the bucket * @param {AuthInfo} authInfo - Instance of AuthInfo class with requester's info * @param {object} request - http request object * @param {object} log - Werelogs logger * @param {function} callback - callback to respond to ht
(authInfo, request, log, callback)
| 28 | * @return {undefined} |
| 29 | */ |
| 30 | function bucketGetObjectLock(authInfo, request, log, callback) { |
| 31 | log.debug('processing request', { method: 'bucketGetObjectLock' }); |
| 32 | const { bucketName, headers, method } = request; |
| 33 | const metadataValParams = { |
| 34 | authInfo, |
| 35 | bucketName, |
| 36 | requestType: request.apiMethods || 'bucketGetObjectLock', |
| 37 | request, |
| 38 | }; |
| 39 | return standardMetadataValidateBucket(metadataValParams, request.actionImplicitDenies, log, (err, bucket) => { |
| 40 | const corsHeaders = collectCorsHeaders(headers.origin, method, bucket); |
| 41 | if (err) { |
| 42 | log.debug('error processing request', { |
| 43 | error: err, |
| 44 | method: 'bucketGetObjectLock', |
| 45 | }); |
| 46 | return callback(err, null, corsHeaders); |
| 47 | } |
| 48 | const objectLockEnabled = bucket.isObjectLockEnabled(); |
| 49 | const bucketObjLockConfig = bucket.getObjectLockConfiguration(); |
| 50 | const objLockConfig = bucketObjLockConfig || {}; |
| 51 | if (!objectLockEnabled) { |
| 52 | log.debug('object lock is not enabled', { |
| 53 | error: errors.ObjectLockConfigurationNotFoundError, |
| 54 | method: 'bucketGetObjectLock', |
| 55 | }); |
| 56 | return callback(errors.ObjectLockConfigurationNotFoundError, null, |
| 57 | corsHeaders); |
| 58 | } |
| 59 | const xml = ObjectLockConfiguration.getConfigXML(objLockConfig); |
| 60 | pushMetric('getBucketObjectLock', log, { |
| 61 | authInfo, |
| 62 | bucket: bucketName, |
| 63 | }); |
| 64 | return callback(null, xml, corsHeaders); |
| 65 | }); |
| 66 | } |
| 67 | |
| 68 | module.exports = bucketGetObjectLock; |
no test coverage detected