mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 12:21:26 -07:00
[cloud] new module lambda_policy (PR #24951)
- Fixes to lambda - reformatting + tests for lambda_facts - lambda module integration test - switch lambda and lambda_facts to AnsibleAwsModule - Get the account ID from STS, GetUser, and finally error message
This commit is contained in:
parent
c36c34ef7e
commit
fbec5ab12d
16 changed files with 1481 additions and 123 deletions
34
test/integration/targets/aws_lambda/files/mini_lambda.py
Normal file
34
test/integration/targets/aws_lambda/files/mini_lambda.py
Normal file
|
@ -0,0 +1,34 @@
|
|||
from __future__ import print_function
|
||||
import json
|
||||
|
||||
|
||||
def handler(event, context):
|
||||
"""
|
||||
The handler function is the function which gets called each time
|
||||
the lambda is run.
|
||||
"""
|
||||
# printing goes to the cloudwatch log allowing us to simply debug the lambda if we can find
|
||||
# the log entry.
|
||||
print("got event:\n" + json.dumps(event))
|
||||
|
||||
# if the name parameter isn't present this can throw an exception
|
||||
# which will result in an amazon chosen failure from the lambda
|
||||
# which can be completely fine.
|
||||
|
||||
name = event["name"]
|
||||
|
||||
return {"message": "hello " + name}
|
||||
|
||||
|
||||
def main():
|
||||
"""
|
||||
This main function will normally never be called during normal
|
||||
lambda use. It is here for testing the lambda program only.
|
||||
"""
|
||||
event = {"name": "james"}
|
||||
context = None
|
||||
print(handler(event, context))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Loading…
Add table
Add a link
Reference in a new issue