Last active
June 12, 2020 10:39
-
-
Save yicr/1959d21ad5e4445a7000583abecb2589 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const generatePolicy = function(principalId, effect, resource) { | |
const authResponse = {}; | |
authResponse.principalId = principalId; | |
if (effect && resource) { | |
const policyDocument = {}; | |
policyDocument.Version = '2012-10-17'; // default version | |
policyDocument.Statement = []; | |
const statementOne = {}; | |
statementOne.Action = 'execute-api:Invoke'; // default action | |
statementOne.Effect = effect; | |
statementOne.Resource = [ | |
// resource, | |
"arn:aws:execute-api:ap-northeast-1:s:todo/todo/*", | |
]; | |
policyDocument.Statement[0] = statementOne; | |
authResponse.policyDocument = policyDocument; | |
} | |
return authResponse; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment