* bucketGetNotification - Return notification 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
(authInfo, request, log, callback)
| 32 | * @return {undefined} |
| 33 | */ |
| 34 | function bucketGetNotification(authInfo, request, log, callback) { |
| 35 | log.debug('processing request', { method: 'bucketGetNotification' }); |
| 36 | const { bucketName, headers, method } = request; |
| 37 | const metadataValParams = { |
| 38 | authInfo, |
| 39 | bucketName, |
| 40 | requestType: request.apiMethods || 'bucketGetNotification', |
| 41 | request, |
| 42 | }; |
| 43 | |
| 44 | return standardMetadataValidateBucket(metadataValParams, request.actionImplicitDenies, log, (err, bucket) => { |
| 45 | const corsHeaders = collectCorsHeaders(headers.origin, method, bucket); |
| 46 | if (err) { |
| 47 | log.debug('error processing request', { |
| 48 | error: err, |
| 49 | method: 'bucketGetNotification', |
| 50 | }); |
| 51 | return callback(err, null, corsHeaders); |
| 52 | } |
| 53 | const bucketNotifConfig = bucket.getNotificationConfiguration(); |
| 54 | const notifXml = NotificationConfiguration.getConfigXML(bucketNotifConfig); |
| 55 | // TODO: implement Utapi metric support |
| 56 | // bucketPolicy needs to be JSON stringified on return for proper |
| 57 | // parsing on return to caller function |
| 58 | pushMetric('getBucketNotification', log, { |
| 59 | authInfo, |
| 60 | bucket: bucketName, |
| 61 | }); |
| 62 | return callback(null, notifXml, corsHeaders); |
| 63 | }); |
| 64 | } |
| 65 | |
| 66 | module.exports = bucketGetNotification; |
no test coverage detected