INNER CODE UNIT · JavaScript
normalizeArn
serverless-operations/serverless-step-functions · lib/deploy/stepFunctions/iamStrategies/index.js:137
function normalizeArn(resource) {
if (typeof resource !== 'string') return resource;
return resource.replace(/^arn:(aws(-[a-z]+)*|\$\{AWS::Partition\}):/, 'arn:aws:');
}
function getPermissions(state, context) {
const normalizedArn = normalizeArn(state.Resource);
const handler = registry.get(normalizedArn);
if (handler) {
return handler(state, context);
}
return lambda.getFallbackPermissions(state, context);
}
module.exports = { getPermissions };