(request, response, type, dataStoreVersionId, log, callback)
| 284 | } |
| 285 | |
| 286 | function handleTaggingOperation(request, response, type, dataStoreVersionId, log, callback) { |
| 287 | const storageLocation = request.headers['x-scal-storage-class']; |
| 288 | const objectMD = { |
| 289 | dataStoreName: storageLocation, |
| 290 | location: [{ dataStoreVersionId }], |
| 291 | }; |
| 292 | if (type === 'Put') { |
| 293 | try { |
| 294 | const tags = JSON.parse(request.headers['x-scal-tags']); |
| 295 | objectMD.tags = tags; |
| 296 | } catch { |
| 297 | // FIXME: add error type MalformedJSON |
| 298 | return callback(errors.MalformedPOSTRequest); |
| 299 | } |
| 300 | } |
| 301 | return dataClient.objectTagging(type, request.objectKey, request.bucketName, objectMD, log, err => { |
| 302 | if (err) { |
| 303 | log.error(`error during object tagging: ${type}`, { |
| 304 | error: err, |
| 305 | method: 'handleTaggingOperation', |
| 306 | }); |
| 307 | return callback(err); |
| 308 | } |
| 309 | const dataRetrievalInfo = { |
| 310 | versionId: dataStoreVersionId, |
| 311 | }; |
| 312 | return response ? _respond(response, dataRetrievalInfo, log, callback) : callback(); |
| 313 | }); |
| 314 | } |
| 315 | |
| 316 | /* |
| 317 | PUT /_/backbeat/metadata/<bucket name>/<object key> |
no test coverage detected