MCPcopy Index your code
hub / github.com/scality/cloudserver / bucketGetVersioning

Function bucketGetVersioning

lib/api/bucketGetVersioning.js:49–81  ·  view source on GitHub ↗

* bucketGetVersioning - Return Versioning Configuration for 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 http re

(authInfo, request, log, callback)

Source from the content-addressed store, hash-verified

47 * @return {undefined}
48 */
49function bucketGetVersioning(authInfo, request, log, callback) {
50 log.debug('processing request', { method: 'bucketGetVersioning' });
51
52 const bucketName = request.bucketName;
53
54 const metadataValParams = {
55 authInfo,
56 bucketName,
57 requestType: request.apiMethods || 'bucketGetVersioning',
58 request,
59 };
60
61 standardMetadataValidateBucket(metadataValParams, request.actionImplicitDenies, log, (err, bucket) => {
62 const corsHeaders = collectCorsHeaders(request.headers.origin,
63 request.method, bucket);
64 if (err) {
65 log.debug('error processing request',
66 { method: 'bucketGetVersioning', error: err });
67 monitoring.promMetrics(
68 'GET', bucketName, err.code, 'getBucketVersioning');
69 return callback(err, null, corsHeaders);
70 }
71 const versioningConfiguration = bucket.getVersioningConfiguration();
72 const xml = convertToXml(versioningConfiguration);
73 pushMetric('getBucketVersioning', log, {
74 authInfo,
75 bucket: bucketName,
76 });
77 monitoring.promMetrics(
78 'GET', bucketName, '200', 'getBucketVersioning');
79 return callback(null, xml, corsHeaders);
80 });
81}
82
83module.exports = bucketGetVersioning;

Callers

nothing calls this directly

Calls 5

collectCorsHeadersFunction · 0.85
pushMetricFunction · 0.85
debugMethod · 0.80
convertToXmlFunction · 0.70

Tested by

no test coverage detected