{"action":"created","comment":{"url":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/comments/63076230","id":63076230,"diff_hunk":"@@ -0,0 +1,545 @@\n+#!/usr/bin/python\n+# (c) 2016, Pierre Jodouin <pjodouin@virtualcomputing.solutions>\n+#\n+# Ansible is free software: you can redistribute it and/or modify\n+# it under the terms of the GNU General Public License as published by\n+# the Free Software Foundation, either version 3 of the License, or\n+# (at your option) any later version.\n+#\n+# Ansible is distributed in the hope that it will be useful,\n+# but WITHOUT ANY WARRANTY; without even the implied warranty of\n+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+# GNU General Public License for more details.\n+#\n+# You should have received a copy of the GNU General Public License\n+# along with Ansible.  If not, see <http://www.gnu.org/licenses/>.\n+\n+import hashlib\n+import base64\n+import os\n+import sys\n+\n+try:\n+    import boto3\n+    from botocore.exceptions import ClientError, ParamValidationError, MissingParametersError\n+    from boto3.s3.transfer import S3Transfer\n+    HAS_BOTO3 = True\n+except ImportError:\n+    HAS_BOTO3 = False\n+\n+\n+DOCUMENTATION = '''\n+---\n+module: lambda\n+short_description: Creates, updates or deletes AWS Lambda functions, configs and versions.\n+description:\n+    - This module allows the management of AWS Lambda functions and their related resources via the Ansible\n+      framework.  It is idempotent and supports \"Check\" mode. Use M(lambda_alias) to manage lambda function aliases,\n+      M(lambda_event) to manage event source mappings such as Kinesis streams, M(lambda_invoke)\n+      to execute a lambda function and M(lambda_facts) to gather facts relating to one or more lambda functions.\n+\n+version_added: \"2.2\"\n+\n+author: Pierre Jodouin (@pjodouin)\n+options:\n+  name:\n+    description:\n+      - The name you want to assign to the function. You can specify an unqualified function\n+        name (for example, \"Thumbnail\") or you can specify Amazon Resource Name (ARN) of the function \n+        (for example, 'arn:aws:lambda:us-west-2:account-id:function:ThumbNail'). AWS Lambda also allows you to\n+        specify only the account ID qualifier (for example, 'account-id:Thumbnail'). Note that the length\n+        constraint applies only to the ARN. If you specify only the function name, it is limited to 64 character \n+        in length.\n+    required: true\n+    aliases: [ \"function_name\" ]\n+  state:\n+    description:\n+      - Describes the desired state and defaults to \"present\".\n+    required: true\n+    default: \"present\"\n+    choices: [\"present\", \"absent\"]\n+  runtime:\n+    description:\n+      - Runtime environment of the Lambda function. Cannot be changed after creating the function.\n+    required: true\n+  code_s3_bucket:\n+    description:\n+      - S3 bucket name where the .zip file containing your deployment package is stored.\n+        This bucket must reside in the same AWS region where you are creating the Lambda function.\n+    required: true\n+    aliases: ['s3_bucket']\n+  code_s3_key:\n+    description:\n+      - S3 object (the deployment package) key name you want to upload.\n+    required: true\n+    aliases: ['s3_key']\n+  code_s3_object_version:\n+    description:\n+      - S3 object (the deployment package) version you want to upload.\n+    required: false\n+    aliases: ['s3_object_version']\n+  local_path:\n+    description:\n+      - Complete local file path of the deployment package bundled in a ZIP archive.\n+    required: true\n+  handler:\n+    description:\n+      - The function within your code that Lambda calls to begin execution.\n+    required: true\n+  role:\n+    description:\n+      - The Amazon Resource Name (ARN) of the IAM role that Lambda assumes when it executes your function to access \n+        any other AWS resources.  If the role belongs to the same account, the simple role name can be used.\n+    required: true\n+  timeout:\n+    description:\n+      - The function execution time at which Lambda should terminate the function. Because the execution time has cost ","path":"cloud/amazon/lambda.py","position":96,"original_position":96,"commit_id":"50e3ddbedc7dc5e55602fbaec78d363f0cb946d5","original_commit_id":"50e3ddbedc7dc5e55602fbaec78d363f0cb946d5","user":{"login":"gundalow","id":940557,"avatar_url":"https://avatars.githubusercontent.com/u/940557?v=3","gravatar_id":"","url":"https://api.github.com/users/gundalow","html_url":"https://github.com/gundalow","followers_url":"https://api.github.com/users/gundalow/followers","following_url":"https://api.github.com/users/gundalow/following{/other_user}","gists_url":"https://api.github.com/users/gundalow/gists{/gist_id}","starred_url":"https://api.github.com/users/gundalow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gundalow/subscriptions","organizations_url":"https://api.github.com/users/gundalow/orgs","repos_url":"https://api.github.com/users/gundalow/repos","events_url":"https://api.github.com/users/gundalow/events{/privacy}","received_events_url":"https://api.github.com/users/gundalow/received_events","type":"User","site_admin":false},"body":"The function execution time (in seconds)\r\n\r\nAlso please remove the detail about default, that's captured below","created_at":"2016-05-12T18:52:46Z","updated_at":"2016-05-12T18:52:46Z","html_url":"https://github.com/ansible/ansible-modules-extras/pull/1890#discussion_r63076230","pull_request_url":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/1890","_links":{"self":{"href":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/comments/63076230"},"html":{"href":"https://github.com/ansible/ansible-modules-extras/pull/1890#discussion_r63076230"},"pull_request":{"href":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/1890"}}},"pull_request":{"url":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/1890","id":63650391,"html_url":"https://github.com/ansible/ansible-modules-extras/pull/1890","diff_url":"https://github.com/ansible/ansible-modules-extras/pull/1890.diff","patch_url":"https://github.com/ansible/ansible-modules-extras/pull/1890.patch","issue_url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/1890","number":1890,"state":"open","locked":false,"title":"AWS lambda modules","user":{"login":"pjodouin","id":1208458,"avatar_url":"https://avatars.githubusercontent.com/u/1208458?v=3","gravatar_id":"","url":"https://api.github.com/users/pjodouin","html_url":"https://github.com/pjodouin","followers_url":"https://api.github.com/users/pjodouin/followers","following_url":"https://api.github.com/users/pjodouin/following{/other_user}","gists_url":"https://api.github.com/users/pjodouin/gists{/gist_id}","starred_url":"https://api.github.com/users/pjodouin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pjodouin/subscriptions","organizations_url":"https://api.github.com/users/pjodouin/orgs","repos_url":"https://api.github.com/users/pjodouin/repos","events_url":"https://api.github.com/users/pjodouin/events{/privacy}","received_events_url":"https://api.github.com/users/pjodouin/received_events","type":"User","site_admin":false},"body":"##### Issue Type:\r\n\r\n - New Modules Pull Request\r\n\r\n##### Plugin Name:\r\n\r\nlambda\r\nlambda_facts\r\nlambda_alias\r\nlambda_event\r\nlambda_invoke\r\nlambda_policy\r\n\r\n##### Summary:\r\n\r\nThese modules help manage AWS Lambda resources including code, configuration, aliases, versions and event source mappings. \r\n\r\n##### Example:\r\n\r\n```\r\n---\r\n- hosts: localhost\r\n  gather_facts: no\r\n  vars:\r\n    state: present\r\n    project_folder: /path/to/your/project/folder\r\n    deployment_package: lambda.zip\r\n    account: 123456789012\r\n    function_name: ingestData\r\n\r\n  tasks:\r\n  - name: gather lambda facts\r\n    lambda_facts:\r\n      name: \"{{ function_name }}\"\r\n      query: all\r\n\r\n  - name: AWS Lambda Function\r\n    lambda:\r\n      state: \"{{ state | default('present') }}\"\r\n      name: \"{{ function_name }}\"\r\n      publish: True\r\n      description: lambda function description\r\n      code_s3_bucket: package-name\r\n      code_s3_key: \"lambda/{{ deployment_package }}\"\r\n      local_path: \"{{ project_folder }}/{{ deployment_package }}\"\r\n      runtime: python2.7\r\n      timeout: 5\r\n      handler: lambda.handler\r\n      memory_size: 192\r\n      role: API2LambdaExecRole\r\n\r\n  - name: \"alias 'Dev' for function {{ function_name }}\"\r\n    lambda_alias:\r\n      state: \"{{ state | default('present') }}\"\r\n      function_name: \"{{ function_name }}\"\r\n      name: Dev\r\n      description: Development is $LATEST version\r\n\r\n  - name: Lambda policy for S3 event notifications\r\n    lambda_policy:\r\n      state: \"{{ state | default('present') }}\"\r\n      function_name: functionName\r\n      alias: Dev\r\n      statement_id: lambda-s3-myBucket-create-data-log\r\n      action: lambda:InvokeFunction\r\n      principal: s3.amazonaws.com\r\n      source_arn: arn:aws:s3:eu-central-1:123456789012:bucketName\r\n      source_account: 123456789012\r\n\r\n  - name: DynamoDB stream event mapping\r\n    lambda_event:\r\n      state: \"{{ state | default('present') }}\"\r\n      event_source: stream\r\n      function_name: \"{{ function_name }}\"\r\n      alias: Dev\r\n      source_params:\r\n        source_arn: arn:aws:dynamodb::123456789012:table/tableName/stream/2016-03-19T19:51\r\n        enabled: True\r\n        batch_size: 120\r\n        starting_position: TRIM_HORIZON\r\n\r\n  - name: execute lambda function\r\n    lambda_invoke:\r\n      function_name: \"{{ function_name }}\"\r\n      qualifier: Dev\r\n      invocation_type: RequestResponse\r\n\r\n  - debug: var=lambda_invocation_results\r\n\r\n```","created_at":"2016-03-21T23:44:02Z","updated_at":"2016-05-12T18:52:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"973b785815ceaa05fa8574bc70bf2ffc5bb8d716","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/1890/commits","review_comments_url":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/1890/comments","review_comment_url":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/1890/comments","statuses_url":"https://api.github.com/repos/ansible/ansible-modules-extras/statuses/50e3ddbedc7dc5e55602fbaec78d363f0cb946d5","head":{"label":"pjodouin:devel","ref":"devel","sha":"50e3ddbedc7dc5e55602fbaec78d363f0cb946d5","user":{"login":"pjodouin","id":1208458,"avatar_url":"https://avatars.githubusercontent.com/u/1208458?v=3","gravatar_id":"","url":"https://api.github.com/users/pjodouin","html_url":"https://github.com/pjodouin","followers_url":"https://api.github.com/users/pjodouin/followers","following_url":"https://api.github.com/users/pjodouin/following{/other_user}","gists_url":"https://api.github.com/users/pjodouin/gists{/gist_id}","starred_url":"https://api.github.com/users/pjodouin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pjodouin/subscriptions","organizations_url":"https://api.github.com/users/pjodouin/orgs","repos_url":"https://api.github.com/users/pjodouin/repos","events_url":"https://api.github.com/users/pjodouin/events{/privacy}","received_events_url":"https://api.github.com/users/pjodouin/received_events","type":"User","site_admin":false},"repo":{"id":54430288,"name":"ansible-modules-extras","full_name":"pjodouin/ansible-modules-extras","owner":{"login":"pjodouin","id":1208458,"avatar_url":"https://avatars.githubusercontent.com/u/1208458?v=3","gravatar_id":"","url":"https://api.github.com/users/pjodouin","html_url":"https://github.com/pjodouin","followers_url":"https://api.github.com/users/pjodouin/followers","following_url":"https://api.github.com/users/pjodouin/following{/other_user}","gists_url":"https://api.github.com/users/pjodouin/gists{/gist_id}","starred_url":"https://api.github.com/users/pjodouin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pjodouin/subscriptions","organizations_url":"https://api.github.com/users/pjodouin/orgs","repos_url":"https://api.github.com/users/pjodouin/repos","events_url":"https://api.github.com/users/pjodouin/events{/privacy}","received_events_url":"https://api.github.com/users/pjodouin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pjodouin/ansible-modules-extras","description":"Ansible extra modules - these modules ship with ansible","fork":true,"url":"https://api.github.com/repos/pjodouin/ansible-modules-extras","forks_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/forks","keys_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/teams","hooks_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/hooks","issue_events_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/issues/events{/number}","events_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/events","assignees_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/assignees{/user}","branches_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/branches{/branch}","tags_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/tags","blobs_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/git/refs{/sha}","trees_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/statuses/{sha}","languages_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/languages","stargazers_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/stargazers","contributors_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/contributors","subscribers_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/subscribers","subscription_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/subscription","commits_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/commits{/sha}","git_commits_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/git/commits{/sha}","comments_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/comments{/number}","issue_comment_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/issues/comments{/number}","contents_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/contents/{+path}","compare_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/merges","archive_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/downloads","issues_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/issues{/number}","pulls_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/pulls{/number}","milestones_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/milestones{/number}","notifications_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/labels{/name}","releases_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/releases{/id}","deployments_url":"https://api.github.com/repos/pjodouin/ansible-modules-extras/deployments","created_at":"2016-03-21T23:28:58Z","updated_at":"2016-03-21T23:29:02Z","pushed_at":"2016-05-07T19:30:22Z","git_url":"git://github.com/pjodouin/ansible-modules-extras.git","ssh_url":"git@github.com:pjodouin/ansible-modules-extras.git","clone_url":"https://github.com/pjodouin/ansible-modules-extras.git","svn_url":"https://github.com/pjodouin/ansible-modules-extras","homepage":"","size":7202,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"devel"}},"base":{"label":"ansible:devel","ref":"devel","sha":"a4b631522dcb02d919b0774a71fefc627013f0f5","user":{"login":"ansible","id":1507452,"avatar_url":"https://avatars.githubusercontent.com/u/1507452?v=3","gravatar_id":"","url":"https://api.github.com/users/ansible","html_url":"https://github.com/ansible","followers_url":"https://api.github.com/users/ansible/followers","following_url":"https://api.github.com/users/ansible/following{/other_user}","gists_url":"https://api.github.com/users/ansible/gists{/gist_id}","starred_url":"https://api.github.com/users/ansible/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ansible/subscriptions","organizations_url":"https://api.github.com/users/ansible/orgs","repos_url":"https://api.github.com/users/ansible/repos","events_url":"https://api.github.com/users/ansible/events{/privacy}","received_events_url":"https://api.github.com/users/ansible/received_events","type":"Organization","site_admin":false},"repo":{"id":24474138,"name":"ansible-modules-extras","full_name":"ansible/ansible-modules-extras","owner":{"login":"ansible","id":1507452,"avatar_url":"https://avatars.githubusercontent.com/u/1507452?v=3","gravatar_id":"","url":"https://api.github.com/users/ansible","html_url":"https://github.com/ansible","followers_url":"https://api.github.com/users/ansible/followers","following_url":"https://api.github.com/users/ansible/following{/other_user}","gists_url":"https://api.github.com/users/ansible/gists{/gist_id}","starred_url":"https://api.github.com/users/ansible/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ansible/subscriptions","organizations_url":"https://api.github.com/users/ansible/orgs","repos_url":"https://api.github.com/users/ansible/repos","events_url":"https://api.github.com/users/ansible/events{/privacy}","received_events_url":"https://api.github.com/users/ansible/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ansible/ansible-modules-extras","description":"Ansible extra modules - these modules ship with ansible","fork":false,"url":"https://api.github.com/repos/ansible/ansible-modules-extras","forks_url":"https://api.github.com/repos/ansible/ansible-modules-extras/forks","keys_url":"https://api.github.com/repos/ansible/ansible-modules-extras/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ansible/ansible-modules-extras/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ansible/ansible-modules-extras/teams","hooks_url":"https://api.github.com/repos/ansible/ansible-modules-extras/hooks","issue_events_url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/events{/number}","events_url":"https://api.github.com/repos/ansible/ansible-modules-extras/events","assignees_url":"https://api.github.com/repos/ansible/ansible-modules-extras/assignees{/user}","branches_url":"https://api.github.com/repos/ansible/ansible-modules-extras/branches{/branch}","tags_url":"https://api.github.com/repos/ansible/ansible-modules-extras/tags","blobs_url":"https://api.github.com/repos/ansible/ansible-modules-extras/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ansible/ansible-modules-extras/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ansible/ansible-modules-extras/git/refs{/sha}","trees_url":"https://api.github.com/repos/ansible/ansible-modules-extras/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ansible/ansible-modules-extras/statuses/{sha}","languages_url":"https://api.github.com/repos/ansible/ansible-modules-extras/languages","stargazers_url":"https://api.github.com/repos/ansible/ansible-modules-extras/stargazers","contributors_url":"https://api.github.com/repos/ansible/ansible-modules-extras/contributors","subscribers_url":"https://api.github.com/repos/ansible/ansible-modules-extras/subscribers","subscription_url":"https://api.github.com/repos/ansible/ansible-modules-extras/subscription","commits_url":"https://api.github.com/repos/ansible/ansible-modules-extras/commits{/sha}","git_commits_url":"https://api.github.com/repos/ansible/ansible-modules-extras/git/commits{/sha}","comments_url":"https://api.github.com/repos/ansible/ansible-modules-extras/comments{/number}","issue_comment_url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/comments{/number}","contents_url":"https://api.github.com/repos/ansible/ansible-modules-extras/contents/{+path}","compare_url":"https://api.github.com/repos/ansible/ansible-modules-extras/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ansible/ansible-modules-extras/merges","archive_url":"https://api.github.com/repos/ansible/ansible-modules-extras/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ansible/ansible-modules-extras/downloads","issues_url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues{/number}","pulls_url":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls{/number}","milestones_url":"https://api.github.com/repos/ansible/ansible-modules-extras/milestones{/number}","notifications_url":"https://api.github.com/repos/ansible/ansible-modules-extras/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ansible/ansible-modules-extras/labels{/name}","releases_url":"https://api.github.com/repos/ansible/ansible-modules-extras/releases{/id}","deployments_url":"https://api.github.com/repos/ansible/ansible-modules-extras/deployments","created_at":"2014-09-25T20:28:42Z","updated_at":"2016-05-12T18:11:09Z","pushed_at":"2016-05-12T18:36:56Z","git_url":"git://github.com/ansible/ansible-modules-extras.git","ssh_url":"git@github.com:ansible/ansible-modules-extras.git","clone_url":"https://github.com/ansible/ansible-modules-extras.git","svn_url":"https://github.com/ansible/ansible-modules-extras","homepage":"","size":13974,"stargazers_count":578,"watchers_count":578,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1189,"mirror_url":null,"open_issues_count":583,"forks":1189,"open_issues":583,"watchers":578,"default_branch":"devel"}},"_links":{"self":{"href":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/1890"},"html":{"href":"https://github.com/ansible/ansible-modules-extras/pull/1890"},"issue":{"href":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/1890"},"comments":{"href":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/1890/comments"},"review_comments":{"href":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/1890/comments"},"review_comment":{"href":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/1890/commits"},"statuses":{"href":"https://api.github.com/repos/ansible/ansible-modules-extras/statuses/50e3ddbedc7dc5e55602fbaec78d363f0cb946d5"}}}}