* update restore expiration date. * * @param {ObjectMD} objectMD - objectMD instance * @param {object} restoreParam - restore param * @param {object} log - werelogs logger * @return {ArsenalError|undefined} internal error if object MD is not valid *
(objectMD, restoreParam, log)
| 208 | * |
| 209 | */ |
| 210 | function _updateRestoreInfo(objectMD, restoreParam, log) { |
| 211 | if (!objectMD.archive) { |
| 212 | log.debug('objectMD.archive doesn\'t exits', { |
| 213 | objectMD, |
| 214 | method: '_updateRestoreInfo' |
| 215 | }); |
| 216 | return errorInstances.InternalError.customizeDescription('Archive metadata is missing.'); |
| 217 | } |
| 218 | /* eslint-disable no-param-reassign */ |
| 219 | objectMD.archive.restoreRequestedAt = new Date(); |
| 220 | objectMD.archive.restoreRequestedDays = restoreParam.days; |
| 221 | objectMD.originOp = 's3:ObjectRestore:Post'; |
| 222 | /* eslint-enable no-param-reassign */ |
| 223 | if (!ObjectMDArchive.isValid(objectMD.archive)) { |
| 224 | log.debug('archive is not valid', { |
| 225 | archive: objectMD.archive, |
| 226 | method: '_updateRestoreInfo' |
| 227 | }); |
| 228 | return errorInstances.InternalError.customizeDescription('Invalid archive metadata.'); |
| 229 | } |
| 230 | return undefined; |
| 231 | } |
| 232 | |
| 233 | /** |
| 234 | * start to restore object. |