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

Function bucketGetTagging

lib/api/bucketGetTagging.js:63–115  ·  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

61 * @return {undefined}
62 */
63function bucketGetTagging(authInfo, request, log, callback) {
64 log.debug('processing request', { method: 'bucketGetTagging' });
65
66 const { bucketName, headers } = request;
67 const metadataValParams = {
68 authInfo,
69 bucketName,
70 requestType: request.apiMethods || 'bucketGetTagging',
71 request,
72 };
73 let bucket = null;
74 let xml = null;
75 let tags = null;
76
77 return waterfall([
78 next => standardMetadataValidateBucket(metadataValParams, request.actionImplicitDenies, log,
79 (err, b) => {
80 bucket = b;
81 return next(err);
82 }),
83 next => checkExpectedBucketOwner(headers, bucket, log, next),
84 next => {
85 tags = bucket.getTags();
86 if (!tags || !tags.length) {
87 log.debug('bucket TagSet does not exist', {
88 method: 'bucketGetTagging',
89 });
90 return next(errors.NoSuchTagSet);
91 }
92 xml = tagsToXml(tags);
93 return next();
94 }
95 ], err => {
96 const corsHeaders = collectCorsHeaders(request.headers.origin,
97 request.method, bucket);
98 if (err) {
99 log.debug('error processing request', {
100 error: err,
101 method: 'bucketGetTagging'
102 });
103 monitoring.promMetrics('GET', bucketName, err.code,
104 'getBucketTagging');
105 } else {
106 pushMetric('getBucketTagging', log, {
107 authInfo,
108 bucket: bucketName,
109 });
110 monitoring.promMetrics(
111 'GET', bucketName, '200', 'getBucketTagging');
112 }
113 return callback(err, xml, corsHeaders);
114 });
115}
116
117module.exports = bucketGetTagging;

Callers 2

Calls 7

checkExpectedBucketOwnerFunction · 0.85
tagsToXmlFunction · 0.85
collectCorsHeadersFunction · 0.85
pushMetricFunction · 0.85
debugMethod · 0.80
getTagsMethod · 0.80

Tested by

no test coverage detected