(authInfo, request, log, callback)
| 9 | '<BucketLoggingStatus xmlns="http://doc.s3.amazonaws.com/2006-03-01" />'; |
| 10 | |
| 11 | function bucketGetLogging(authInfo, request, log, callback) { |
| 12 | log.debug('processing request', { method: 'bucketGetLogging' }); |
| 13 | |
| 14 | if (!config.serverAccessLogs || config.serverAccessLogs.mode !== serverAccessLogsModes.ENABLED) { |
| 15 | return callback(errorInstances.NotImplemented); |
| 16 | } |
| 17 | |
| 18 | const bucketName = request.bucketName; |
| 19 | const metadataValParams = { |
| 20 | authInfo, |
| 21 | bucketName, |
| 22 | requestType: request.apiMethods || 'bucketGetLogging', |
| 23 | request, |
| 24 | }; |
| 25 | |
| 26 | return waterfall([ |
| 27 | next => standardMetadataValidateBucket(metadataValParams, request.actionImplicitDenies, log, (err, bucket) => { |
| 28 | if (err) { |
| 29 | return next(err); |
| 30 | } |
| 31 | |
| 32 | return next(null, bucket); |
| 33 | }), |
| 34 | (bucket, next) => checkExpectedBucketOwner(request.headers, bucket, log, err => { |
| 35 | if (err) { |
| 36 | return next(err); |
| 37 | } |
| 38 | |
| 39 | return next(null, bucket); |
| 40 | }), |
| 41 | (bucket, next) => { |
| 42 | const bucketLoggingStatus = bucket.getBucketLoggingStatus(); |
| 43 | if (!bucketLoggingStatus) { |
| 44 | return next(null, BucketLoggingStatusNotFoundBody); |
| 45 | } |
| 46 | |
| 47 | return next(null, bucketLoggingStatus.toXML()); |
| 48 | } |
| 49 | ], (err, body) => { |
| 50 | if (err) { |
| 51 | log.trace('error processing request', { error: err, method: 'bucketGetLogging' }); |
| 52 | monitoring.promMetrics('GET', bucketName, err.code, 'bucketGetLogging'); |
| 53 | return callback(err); |
| 54 | } |
| 55 | |
| 56 | monitoring.promMetrics('GET', bucketName, '200', 'bucketGetLogging'); |
| 57 | return callback(null, body); |
| 58 | }); |
| 59 | } |
| 60 | |
| 61 | module.exports = bucketGetLogging; |
no test coverage detected