def generatePolicy(effect, principalId, resource):
    """Generate a policy based on input."""
    authResponse = {}
    authResponse['principalId'] = principalId
    statementOne = {'Action': 'execute-api:Invoke',
                    'Effect': effect,
                    'Resource': resource}
    policyDocument = {'Version': '2012-10-17', 'Statement': [statementOne]}
    authResponse['policyDocument'] = policyDocument
    authResponse['context'] = {'policyGenerator': 'authorizer.authorize'}
    return authResponse