* Format of xml request: VersioningState MfaDeleteState Note that there is the header in the request if setting MfaDelete: x-amz-mfa: [SerialN
(request, log, cb)
| 37 | */ |
| 38 | |
| 39 | function _parseXML(request, log, cb) { |
| 40 | if (request.post === '') { |
| 41 | log.debug('request xml is missing'); |
| 42 | return cb(errors.MalformedXML); |
| 43 | } |
| 44 | return parseString(request.post, (err, result) => { |
| 45 | if (err) { |
| 46 | log.debug('request xml is malformed'); |
| 47 | return cb(errors.MalformedXML); |
| 48 | } |
| 49 | const versioningConf = result.VersioningConfiguration; |
| 50 | const status = versioningConf.Status ? |
| 51 | versioningConf.Status[0] : undefined; |
| 52 | const mfaDelete = versioningConf.MfaDelete ? |
| 53 | versioningConf.MfaDelete[0] : undefined; |
| 54 | const validStatuses = ['Enabled', 'Suspended']; |
| 55 | const validMfaDeletes = [undefined, 'Enabled', 'Disabled']; |
| 56 | if (validStatuses.indexOf(status) < 0 || |
| 57 | validMfaDeletes.indexOf(mfaDelete) < 0) { |
| 58 | log.debug('illegal versioning configuration'); |
| 59 | return cb(errors.IllegalVersioningConfigurationException); |
| 60 | } |
| 61 | if (versioningConf && mfaDelete === 'Enabled') { |
| 62 | log.debug('mfa deletion is not implemented'); |
| 63 | return cb(errorInstances.NotImplemented |
| 64 | .customizeDescription('MFA Deletion is not supported yet.')); |
| 65 | } |
| 66 | return process.nextTick(() => cb(null)); |
| 67 | }); |
| 68 | } |
| 69 | |
| 70 | function _checkBackendVersioningImplemented(bucket) { |
| 71 | const bucketLocation = bucket.getLocationConstraint(); |
no test coverage detected