function updateEncryption(err, bucket, objMD, objectKey, log, opts, cb) {
    // Error passed here to call the function inbetween the metadataValidate and its callback
    if (err) {
        return cb(err);
    }
    // if objMD missing, still try updateBucketEncryption
    if (!config.sseMigration) {
        return cb(null, bucket, objMD);
    }

    const { previousKeyType, previousKeyProtocol, previousKeyProvider } = config.sseMigration;
    // previousKeyType is required and validated in Config.js
    // for now it is the only implementation we need.
    // See TAD Seamless decryption with internal and external KMS: https://scality.atlassian.net/wiki/x/EgADu
    // for other method of migration without a previousKeyType

    const keyArnPrefix = makeScalityArnPrefix(previousKeyType, previousKeyProtocol, previousKeyProvider);

    return updateBucketEncryption(bucket, log, (err, bucket) => {
        // Any error in updating encryption at bucket or object level is returned to client.
        // Other possibilities: ignore error, include sse migration notice in error message.
        if (err) {
            return cb(err, bucket, objMD);
        }
        if (opts.skipObject) {
            return cb(err, bucket, objMD);
        }
        return updateObjectEncryption(bucket, objMD, objectKey, log, keyArnPrefix, opts, cb);
    });
}
Update encryption of bucket and object if kms provider changed

@param {Error} err - error coming from metadata validate before the action handling
@param {BucketInfo} bucket - bucket
@param {Object} [objMD] - object metadata
@param {string} objectKey  - objectKey from request.
@param {Logger} log - request logger
@param {Object} opts - options for sseMigration
@param {boolean} [opts.skipObject] - ignore object update
@param {boolean} [opts.skipObjectUpdate] - don't update metadata but prepare objMD for later update
@param {Function} cb - callback (err, bucket, objMD)
@returns {undefined}