{"action":"created","comment":{"url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/pulls/comments/195993212","pull_request_review_id":129456341,"id":195993212,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NTk5MzIxMg==","diff_hunk":"@@ -34,6 +36,132 @@ var selfUpdate = function (callback) {\n };\n \n \n+var selfConfigUpdate = function (callback) {\n+    async.waterfall([\n+        function(callback) {\n+            getConfigChanges(function(err, config) {\n+                callback(err, config)\n+            });\n+        },\n+        function(newValues, callback) {\n+            getCurrentConfig(function(err, currentConfig) {\n+                callback(err, newValues, currentConfig)\n+            });\n+        },\n+        function(newValues, currentConfig, callback) {\n+            applyConfigChanges(newValues, currentConfig, function(err, newConfig) {\n+                callback(err, newConfig, currentConfig)\n+            })\n+        },\n+        function(newConfig, currentConfig, callback) {\n+            if (isConfigDifferent(newConfig, currentConfig)) {\n+                var lambda = new AWS.Lambda();\n+                var updateConfig = filterDisallowedConfigParams(newConfig);\n+                return lambda.updateFunctionConfiguration(updateConfig, callback);\n+            } \n+            else {\n+                callback(null);\n+            }\n+        }\n+    ],\n+    function(err, config) {\n+        if (err) {\n+            console.info('Lambda self-update config error: ', err);\n+        } else {\n+            if (config !== undefined) {\n+                console.info('Lambda self-update config successful. Config: ', config);\n+            }\n+            else {\n+                console.info('Lambda self-update config nothing to update');\n+            }\n+        }\n+        callback(err, config);\n+    });\n+};\n+\n+function getConfigChanges(callback) {","path":"al_aws.js","position":59,"original_position":59,"commit_id":"7aac8cecdac27bde904567de7b58b6a105b7c783","original_commit_id":"b9b9c35c9cf59624ac8cbd4300941d1600b7b8d9","user":{"login":"kkuzmin","id":6872804,"node_id":"MDQ6VXNlcjY4NzI4MDQ=","avatar_url":"https://avatars3.githubusercontent.com/u/6872804?v=4","gravatar_id":"","url":"https://api.github.com/users/kkuzmin","html_url":"https://github.com/kkuzmin","followers_url":"https://api.github.com/users/kkuzmin/followers","following_url":"https://api.github.com/users/kkuzmin/following{/other_user}","gists_url":"https://api.github.com/users/kkuzmin/gists{/gist_id}","starred_url":"https://api.github.com/users/kkuzmin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kkuzmin/subscriptions","organizations_url":"https://api.github.com/users/kkuzmin/orgs","repos_url":"https://api.github.com/users/kkuzmin/repos","events_url":"https://api.github.com/users/kkuzmin/events{/privacy}","received_events_url":"https://api.github.com/users/kkuzmin/received_events","type":"User","site_admin":false},"body":"Suggest, `getLambdaConfigRemote()` or `getLambdaConfigS3()`.","created_at":"2018-06-18T08:08:44Z","updated_at":"2018-06-18T08:32:49Z","html_url":"https://github.com/alertlogic/al-aws-collector-js/pull/13#discussion_r195993212","pull_request_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/pulls/13","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/alertlogic/al-aws-collector-js/pulls/comments/195993212"},"html":{"href":"https://github.com/alertlogic/al-aws-collector-js/pull/13#discussion_r195993212"},"pull_request":{"href":"https://api.github.com/repos/alertlogic/al-aws-collector-js/pulls/13"}}},"pull_request":{"url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/pulls/13","id":195372963,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk1MzcyOTYz","html_url":"https://github.com/alertlogic/al-aws-collector-js/pull/13","diff_url":"https://github.com/alertlogic/al-aws-collector-js/pull/13.diff","patch_url":"https://github.com/alertlogic/al-aws-collector-js/pull/13.patch","issue_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/issues/13","number":13,"state":"open","locked":false,"title":"[do not merge] lambda config update","user":{"login":"tomdos","id":6490602,"node_id":"MDQ6VXNlcjY0OTA2MDI=","avatar_url":"https://avatars3.githubusercontent.com/u/6490602?v=4","gravatar_id":"","url":"https://api.github.com/users/tomdos","html_url":"https://github.com/tomdos","followers_url":"https://api.github.com/users/tomdos/followers","following_url":"https://api.github.com/users/tomdos/following{/other_user}","gists_url":"https://api.github.com/users/tomdos/gists{/gist_id}","starred_url":"https://api.github.com/users/tomdos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomdos/subscriptions","organizations_url":"https://api.github.com/users/tomdos/orgs","repos_url":"https://api.github.com/users/tomdos/repos","events_url":"https://api.github.com/users/tomdos/events{/privacy}","received_events_url":"https://api.github.com/users/tomdos/received_events","type":"User","site_admin":false},"body":"### Problem Description\r\nThe library doesn't support a config update.\r\n\r\n### Solution Description\r\nImplement a lambda's config update. The function gets new values from S3 bucket either from predefined of default file name. The format of file is: \r\n```\r\n\"any value\" : {\r\n    \"path\" : \"dot notation path to the requested parameter\"\r\n    \"value\": \"new value\"\r\n}\r\n```\r\nExample:\r\n```\r\n    \"Runtime\": {\r\n        \"path\": \"Runtime\",\r\n        \"value\": \"nodejs8.10\"\r\n    },\r\n    \"Timeout\": {\r\n        \"path\": \"Timeout\",\r\n        \"value\": 5\r\n    },\r\n    \"NewVariableX\": {\r\n        \"path\": \"Environment.Variables.x\",\r\n        \"value\": \"XXXX\"\r\n    },\r\n    \"ChangeVariableAlApi\": {\r\n        \"path\": \"Environment.Variables.al_api\",\r\n        \"value\": \"new al_api value\"\r\n    }\r\n};\r\n```\r\n\r\nThe new config is constructed by applying new values to the current config. If the result differs from the current config it means there are changes and we perform lambda config update.\r\n\r\n@alexturkin @kkuzmin \r\n","created_at":"2018-06-17T11:18:27Z","updated_at":"2018-06-18T08:32:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f1d7314bf9cd16d1fc1919bea13f1f10a83ec405","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/pulls/13/commits","review_comments_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/pulls/13/comments","review_comment_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/issues/13/comments","statuses_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/statuses/7aac8cecdac27bde904567de7b58b6a105b7c783","head":{"label":"alertlogic:update_function_config","ref":"update_function_config","sha":"7aac8cecdac27bde904567de7b58b6a105b7c783","user":{"login":"alertlogic","id":1900859,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5MDA4NTk=","avatar_url":"https://avatars0.githubusercontent.com/u/1900859?v=4","gravatar_id":"","url":"https://api.github.com/users/alertlogic","html_url":"https://github.com/alertlogic","followers_url":"https://api.github.com/users/alertlogic/followers","following_url":"https://api.github.com/users/alertlogic/following{/other_user}","gists_url":"https://api.github.com/users/alertlogic/gists{/gist_id}","starred_url":"https://api.github.com/users/alertlogic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alertlogic/subscriptions","organizations_url":"https://api.github.com/users/alertlogic/orgs","repos_url":"https://api.github.com/users/alertlogic/repos","events_url":"https://api.github.com/users/alertlogic/events{/privacy}","received_events_url":"https://api.github.com/users/alertlogic/received_events","type":"Organization","site_admin":false},"repo":{"id":118116996,"node_id":"MDEwOlJlcG9zaXRvcnkxMTgxMTY5OTY=","name":"al-aws-collector-js","full_name":"alertlogic/al-aws-collector-js","owner":{"login":"alertlogic","id":1900859,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5MDA4NTk=","avatar_url":"https://avatars0.githubusercontent.com/u/1900859?v=4","gravatar_id":"","url":"https://api.github.com/users/alertlogic","html_url":"https://github.com/alertlogic","followers_url":"https://api.github.com/users/alertlogic/followers","following_url":"https://api.github.com/users/alertlogic/following{/other_user}","gists_url":"https://api.github.com/users/alertlogic/gists{/gist_id}","starred_url":"https://api.github.com/users/alertlogic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alertlogic/subscriptions","organizations_url":"https://api.github.com/users/alertlogic/orgs","repos_url":"https://api.github.com/users/alertlogic/repos","events_url":"https://api.github.com/users/alertlogic/events{/privacy}","received_events_url":"https://api.github.com/users/alertlogic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alertlogic/al-aws-collector-js","description":null,"fork":false,"url":"https://api.github.com/repos/alertlogic/al-aws-collector-js","forks_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/forks","keys_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/teams","hooks_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/hooks","issue_events_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/issues/events{/number}","events_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/events","assignees_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/assignees{/user}","branches_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/branches{/branch}","tags_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/tags","blobs_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/statuses/{sha}","languages_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/languages","stargazers_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/stargazers","contributors_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/contributors","subscribers_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/subscribers","subscription_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/subscription","commits_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/contents/{+path}","compare_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/merges","archive_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/downloads","issues_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/issues{/number}","pulls_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/pulls{/number}","milestones_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/milestones{/number}","notifications_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/labels{/name}","releases_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/releases{/id}","deployments_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/deployments","created_at":"2018-01-19T11:24:45Z","updated_at":"2018-06-12T13:05:18Z","pushed_at":"2018-06-18T08:19:50Z","git_url":"git://github.com/alertlogic/al-aws-collector-js.git","ssh_url":"git@github.com:alertlogic/al-aws-collector-js.git","clone_url":"https://github.com/alertlogic/al-aws-collector-js.git","svn_url":"https://github.com/alertlogic/al-aws-collector-js","homepage":null,"size":49,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":2,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"alertlogic:master","ref":"master","sha":"d9c59306c6b11a4daf86c69670adf1ed612c87dc","user":{"login":"alertlogic","id":1900859,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5MDA4NTk=","avatar_url":"https://avatars0.githubusercontent.com/u/1900859?v=4","gravatar_id":"","url":"https://api.github.com/users/alertlogic","html_url":"https://github.com/alertlogic","followers_url":"https://api.github.com/users/alertlogic/followers","following_url":"https://api.github.com/users/alertlogic/following{/other_user}","gists_url":"https://api.github.com/users/alertlogic/gists{/gist_id}","starred_url":"https://api.github.com/users/alertlogic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alertlogic/subscriptions","organizations_url":"https://api.github.com/users/alertlogic/orgs","repos_url":"https://api.github.com/users/alertlogic/repos","events_url":"https://api.github.com/users/alertlogic/events{/privacy}","received_events_url":"https://api.github.com/users/alertlogic/received_events","type":"Organization","site_admin":false},"repo":{"id":118116996,"node_id":"MDEwOlJlcG9zaXRvcnkxMTgxMTY5OTY=","name":"al-aws-collector-js","full_name":"alertlogic/al-aws-collector-js","owner":{"login":"alertlogic","id":1900859,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5MDA4NTk=","avatar_url":"https://avatars0.githubusercontent.com/u/1900859?v=4","gravatar_id":"","url":"https://api.github.com/users/alertlogic","html_url":"https://github.com/alertlogic","followers_url":"https://api.github.com/users/alertlogic/followers","following_url":"https://api.github.com/users/alertlogic/following{/other_user}","gists_url":"https://api.github.com/users/alertlogic/gists{/gist_id}","starred_url":"https://api.github.com/users/alertlogic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alertlogic/subscriptions","organizations_url":"https://api.github.com/users/alertlogic/orgs","repos_url":"https://api.github.com/users/alertlogic/repos","events_url":"https://api.github.com/users/alertlogic/events{/privacy}","received_events_url":"https://api.github.com/users/alertlogic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alertlogic/al-aws-collector-js","description":null,"fork":false,"url":"https://api.github.com/repos/alertlogic/al-aws-collector-js","forks_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/forks","keys_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/teams","hooks_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/hooks","issue_events_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/issues/events{/number}","events_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/events","assignees_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/assignees{/user}","branches_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/branches{/branch}","tags_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/tags","blobs_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/statuses/{sha}","languages_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/languages","stargazers_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/stargazers","contributors_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/contributors","subscribers_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/subscribers","subscription_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/subscription","commits_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/contents/{+path}","compare_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/merges","archive_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/downloads","issues_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/issues{/number}","pulls_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/pulls{/number}","milestones_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/milestones{/number}","notifications_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/labels{/name}","releases_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/releases{/id}","deployments_url":"https://api.github.com/repos/alertlogic/al-aws-collector-js/deployments","created_at":"2018-01-19T11:24:45Z","updated_at":"2018-06-12T13:05:18Z","pushed_at":"2018-06-18T08:19:50Z","git_url":"git://github.com/alertlogic/al-aws-collector-js.git","ssh_url":"git@github.com:alertlogic/al-aws-collector-js.git","clone_url":"https://github.com/alertlogic/al-aws-collector-js.git","svn_url":"https://github.com/alertlogic/al-aws-collector-js","homepage":null,"size":49,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":2,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alertlogic/al-aws-collector-js/pulls/13"},"html":{"href":"https://github.com/alertlogic/al-aws-collector-js/pull/13"},"issue":{"href":"https://api.github.com/repos/alertlogic/al-aws-collector-js/issues/13"},"comments":{"href":"https://api.github.com/repos/alertlogic/al-aws-collector-js/issues/13/comments"},"review_comments":{"href":"https://api.github.com/repos/alertlogic/al-aws-collector-js/pulls/13/comments"},"review_comment":{"href":"https://api.github.com/repos/alertlogic/al-aws-collector-js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alertlogic/al-aws-collector-js/pulls/13/commits"},"statuses":{"href":"https://api.github.com/repos/alertlogic/al-aws-collector-js/statuses/7aac8cecdac27bde904567de7b58b6a105b7c783"}},"author_association":"NONE"}}
{"actor":{"display_login":"kkuzmin"}}