{"action":"created","comment":{"url":"https://api.github.com/repos/portainer/portainer/pulls/comments/208995957","pull_request_review_id":144910157,"id":208995957,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwODk5NTk1Nw==","diff_hunk":"@@ -0,0 +1,66 @@\n+package webhooks\n+\n+//TODO\n+// * Generate random string for TokenData for added security\n+\n+import (\n+\t\"net/http\"\n+\n+\t\"github.com/asaskevich/govalidator\"\n+\t\"github.com/portainer/portainer\"\n+\thttperror \"github.com/portainer/portainer/http/error\"\n+\t\"github.com/portainer/portainer/http/request\"\n+\t\"github.com/portainer/portainer/http/response\"\n+)\n+\n+var letters = []rune(\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890\")\n+\n+// Used for generating random token\n+\n+type webhookCreatePayload struct {\n+\tServiceID  string\n+\tEndpointID int\n+}\n+\n+func (payload *webhookCreatePayload) Validate(r *http.Request) error {\n+\tif govalidator.IsNull(payload.ServiceID) {\n+\t\treturn portainer.Error(\"Missing ServiceID\")\n+\t}\n+\tif govalidator.IsNull(string(payload.EndpointID)) {\n+\t\treturn portainer.Error(\"Missing EndpointID\")","path":"api/http/handler/webhooks/webhook_create.go","position":30,"original_position":30,"commit_id":"65319501a3e0059a70dbd9a07fe81357baa776e8","original_commit_id":"65319501a3e0059a70dbd9a07fe81357baa776e8","user":{"login":"deviantony","id":5485061,"node_id":"MDQ6VXNlcjU0ODUwNjE=","avatar_url":"https://avatars2.githubusercontent.com/u/5485061?v=4","gravatar_id":"","url":"https://api.github.com/users/deviantony","html_url":"https://github.com/deviantony","followers_url":"https://api.github.com/users/deviantony/followers","following_url":"https://api.github.com/users/deviantony/following{/other_user}","gists_url":"https://api.github.com/users/deviantony/gists{/gist_id}","starred_url":"https://api.github.com/users/deviantony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deviantony/subscriptions","organizations_url":"https://api.github.com/users/deviantony/orgs","repos_url":"https://api.github.com/users/deviantony/repos","events_url":"https://api.github.com/users/deviantony/events{/privacy}","received_events_url":"https://api.github.com/users/deviantony/received_events","type":"User","site_admin":false},"body":"To keep consistent with other validation messages, please use the form `Invalid EndpointID`.","created_at":"2018-08-09T16:28:33Z","updated_at":"2018-08-09T16:35:20Z","html_url":"https://github.com/portainer/portainer/pull/2143#discussion_r208995957","pull_request_url":"https://api.github.com/repos/portainer/portainer/pulls/2143","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/portainer/portainer/pulls/comments/208995957"},"html":{"href":"https://github.com/portainer/portainer/pull/2143#discussion_r208995957"},"pull_request":{"href":"https://api.github.com/repos/portainer/portainer/pulls/2143"}}},"pull_request":{"url":"https://api.github.com/repos/portainer/portainer/pulls/2143","id":207363156,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA3MzYzMTU2","html_url":"https://github.com/portainer/portainer/pull/2143","diff_url":"https://github.com/portainer/portainer/pull/2143.diff","patch_url":"https://github.com/portainer/portainer/pull/2143.patch","issue_url":"https://api.github.com/repos/portainer/portainer/issues/2143","number":2143,"state":"open","locked":false,"title":"feat(webhooks): add service webhooks","user":{"login":"deviantony","id":5485061,"node_id":"MDQ6VXNlcjU0ODUwNjE=","avatar_url":"https://avatars2.githubusercontent.com/u/5485061?v=4","gravatar_id":"","url":"https://api.github.com/users/deviantony","html_url":"https://github.com/deviantony","followers_url":"https://api.github.com/users/deviantony/followers","following_url":"https://api.github.com/users/deviantony/following{/other_user}","gists_url":"https://api.github.com/users/deviantony/gists{/gist_id}","starred_url":"https://api.github.com/users/deviantony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deviantony/subscriptions","organizations_url":"https://api.github.com/users/deviantony/orgs","repos_url":"https://api.github.com/users/deviantony/repos","events_url":"https://api.github.com/users/deviantony/events{/privacy}","received_events_url":"https://api.github.com/users/deviantony/received_events","type":"User","site_admin":false},"body":"This is a work-in-progress.\r\n\r\n@kendrickm I'm opening a PR from the branch and tagging it as a WIP, it'll be easier for me to review.\r\n\r\nCloses #1663 ","created_at":"2018-08-09T15:50:54Z","updated_at":"2018-08-09T16:35:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a50941234e1457d8fcba0c7a69df082223c48992","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":604880538,"node_id":"MDU6TGFiZWw2MDQ4ODA1Mzg=","url":"https://api.github.com/repos/portainer/portainer/labels/status/work-in-progress","name":"status/work-in-progress","color":"128A0C","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/portainer/portainer/pulls/2143/commits","review_comments_url":"https://api.github.com/repos/portainer/portainer/pulls/2143/comments","review_comment_url":"https://api.github.com/repos/portainer/portainer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/portainer/portainer/issues/2143/comments","statuses_url":"https://api.github.com/repos/portainer/portainer/statuses/65319501a3e0059a70dbd9a07fe81357baa776e8","head":{"label":"portainer:feat1663-add-webhook","ref":"feat1663-add-webhook","sha":"65319501a3e0059a70dbd9a07fe81357baa776e8","user":{"login":"portainer","id":22225832,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyMjI1ODMy","avatar_url":"https://avatars0.githubusercontent.com/u/22225832?v=4","gravatar_id":"","url":"https://api.github.com/users/portainer","html_url":"https://github.com/portainer","followers_url":"https://api.github.com/users/portainer/followers","following_url":"https://api.github.com/users/portainer/following{/other_user}","gists_url":"https://api.github.com/users/portainer/gists{/gist_id}","starred_url":"https://api.github.com/users/portainer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/portainer/subscriptions","organizations_url":"https://api.github.com/users/portainer/orgs","repos_url":"https://api.github.com/users/portainer/repos","events_url":"https://api.github.com/users/portainer/events{/privacy}","received_events_url":"https://api.github.com/users/portainer/received_events","type":"Organization","site_admin":false},"repo":{"id":59239347,"node_id":"MDEwOlJlcG9zaXRvcnk1OTIzOTM0Nw==","name":"portainer","full_name":"portainer/portainer","owner":{"login":"portainer","id":22225832,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyMjI1ODMy","avatar_url":"https://avatars0.githubusercontent.com/u/22225832?v=4","gravatar_id":"","url":"https://api.github.com/users/portainer","html_url":"https://github.com/portainer","followers_url":"https://api.github.com/users/portainer/followers","following_url":"https://api.github.com/users/portainer/following{/other_user}","gists_url":"https://api.github.com/users/portainer/gists{/gist_id}","starred_url":"https://api.github.com/users/portainer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/portainer/subscriptions","organizations_url":"https://api.github.com/users/portainer/orgs","repos_url":"https://api.github.com/users/portainer/repos","events_url":"https://api.github.com/users/portainer/events{/privacy}","received_events_url":"https://api.github.com/users/portainer/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/portainer/portainer","description":"Simple management UI for Docker","fork":false,"url":"https://api.github.com/repos/portainer/portainer","forks_url":"https://api.github.com/repos/portainer/portainer/forks","keys_url":"https://api.github.com/repos/portainer/portainer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/portainer/portainer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/portainer/portainer/teams","hooks_url":"https://api.github.com/repos/portainer/portainer/hooks","issue_events_url":"https://api.github.com/repos/portainer/portainer/issues/events{/number}","events_url":"https://api.github.com/repos/portainer/portainer/events","assignees_url":"https://api.github.com/repos/portainer/portainer/assignees{/user}","branches_url":"https://api.github.com/repos/portainer/portainer/branches{/branch}","tags_url":"https://api.github.com/repos/portainer/portainer/tags","blobs_url":"https://api.github.com/repos/portainer/portainer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/portainer/portainer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/portainer/portainer/git/refs{/sha}","trees_url":"https://api.github.com/repos/portainer/portainer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/portainer/portainer/statuses/{sha}","languages_url":"https://api.github.com/repos/portainer/portainer/languages","stargazers_url":"https://api.github.com/repos/portainer/portainer/stargazers","contributors_url":"https://api.github.com/repos/portainer/portainer/contributors","subscribers_url":"https://api.github.com/repos/portainer/portainer/subscribers","subscription_url":"https://api.github.com/repos/portainer/portainer/subscription","commits_url":"https://api.github.com/repos/portainer/portainer/commits{/sha}","git_commits_url":"https://api.github.com/repos/portainer/portainer/git/commits{/sha}","comments_url":"https://api.github.com/repos/portainer/portainer/comments{/number}","issue_comment_url":"https://api.github.com/repos/portainer/portainer/issues/comments{/number}","contents_url":"https://api.github.com/repos/portainer/portainer/contents/{+path}","compare_url":"https://api.github.com/repos/portainer/portainer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/portainer/portainer/merges","archive_url":"https://api.github.com/repos/portainer/portainer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/portainer/portainer/downloads","issues_url":"https://api.github.com/repos/portainer/portainer/issues{/number}","pulls_url":"https://api.github.com/repos/portainer/portainer/pulls{/number}","milestones_url":"https://api.github.com/repos/portainer/portainer/milestones{/number}","notifications_url":"https://api.github.com/repos/portainer/portainer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/portainer/portainer/labels{/name}","releases_url":"https://api.github.com/repos/portainer/portainer/releases{/id}","deployments_url":"https://api.github.com/repos/portainer/portainer/deployments","created_at":"2016-05-19T20:15:28Z","updated_at":"2018-08-09T15:53:32Z","pushed_at":"2018-08-09T16:16:39Z","git_url":"git://github.com/portainer/portainer.git","ssh_url":"git@github.com:portainer/portainer.git","clone_url":"https://github.com/portainer/portainer.git","svn_url":"https://github.com/portainer/portainer","homepage":"http://portainer.io","size":17188,"stargazers_count":8868,"watchers_count":8868,"language":"HTML","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":861,"mirror_url":null,"archived":false,"open_issues_count":346,"license":{"key":"zlib","name":"zlib License","spdx_id":"Zlib","url":"https://api.github.com/licenses/zlib","node_id":"MDc6TGljZW5zZTI3"},"forks":861,"open_issues":346,"watchers":8868,"default_branch":"develop"}},"base":{"label":"portainer:develop","ref":"develop","sha":"9c0b568773895cd6b05f9752588839f3d03a0c69","user":{"login":"portainer","id":22225832,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyMjI1ODMy","avatar_url":"https://avatars0.githubusercontent.com/u/22225832?v=4","gravatar_id":"","url":"https://api.github.com/users/portainer","html_url":"https://github.com/portainer","followers_url":"https://api.github.com/users/portainer/followers","following_url":"https://api.github.com/users/portainer/following{/other_user}","gists_url":"https://api.github.com/users/portainer/gists{/gist_id}","starred_url":"https://api.github.com/users/portainer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/portainer/subscriptions","organizations_url":"https://api.github.com/users/portainer/orgs","repos_url":"https://api.github.com/users/portainer/repos","events_url":"https://api.github.com/users/portainer/events{/privacy}","received_events_url":"https://api.github.com/users/portainer/received_events","type":"Organization","site_admin":false},"repo":{"id":59239347,"node_id":"MDEwOlJlcG9zaXRvcnk1OTIzOTM0Nw==","name":"portainer","full_name":"portainer/portainer","owner":{"login":"portainer","id":22225832,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyMjI1ODMy","avatar_url":"https://avatars0.githubusercontent.com/u/22225832?v=4","gravatar_id":"","url":"https://api.github.com/users/portainer","html_url":"https://github.com/portainer","followers_url":"https://api.github.com/users/portainer/followers","following_url":"https://api.github.com/users/portainer/following{/other_user}","gists_url":"https://api.github.com/users/portainer/gists{/gist_id}","starred_url":"https://api.github.com/users/portainer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/portainer/subscriptions","organizations_url":"https://api.github.com/users/portainer/orgs","repos_url":"https://api.github.com/users/portainer/repos","events_url":"https://api.github.com/users/portainer/events{/privacy}","received_events_url":"https://api.github.com/users/portainer/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/portainer/portainer","description":"Simple management UI for Docker","fork":false,"url":"https://api.github.com/repos/portainer/portainer","forks_url":"https://api.github.com/repos/portainer/portainer/forks","keys_url":"https://api.github.com/repos/portainer/portainer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/portainer/portainer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/portainer/portainer/teams","hooks_url":"https://api.github.com/repos/portainer/portainer/hooks","issue_events_url":"https://api.github.com/repos/portainer/portainer/issues/events{/number}","events_url":"https://api.github.com/repos/portainer/portainer/events","assignees_url":"https://api.github.com/repos/portainer/portainer/assignees{/user}","branches_url":"https://api.github.com/repos/portainer/portainer/branches{/branch}","tags_url":"https://api.github.com/repos/portainer/portainer/tags","blobs_url":"https://api.github.com/repos/portainer/portainer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/portainer/portainer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/portainer/portainer/git/refs{/sha}","trees_url":"https://api.github.com/repos/portainer/portainer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/portainer/portainer/statuses/{sha}","languages_url":"https://api.github.com/repos/portainer/portainer/languages","stargazers_url":"https://api.github.com/repos/portainer/portainer/stargazers","contributors_url":"https://api.github.com/repos/portainer/portainer/contributors","subscribers_url":"https://api.github.com/repos/portainer/portainer/subscribers","subscription_url":"https://api.github.com/repos/portainer/portainer/subscription","commits_url":"https://api.github.com/repos/portainer/portainer/commits{/sha}","git_commits_url":"https://api.github.com/repos/portainer/portainer/git/commits{/sha}","comments_url":"https://api.github.com/repos/portainer/portainer/comments{/number}","issue_comment_url":"https://api.github.com/repos/portainer/portainer/issues/comments{/number}","contents_url":"https://api.github.com/repos/portainer/portainer/contents/{+path}","compare_url":"https://api.github.com/repos/portainer/portainer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/portainer/portainer/merges","archive_url":"https://api.github.com/repos/portainer/portainer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/portainer/portainer/downloads","issues_url":"https://api.github.com/repos/portainer/portainer/issues{/number}","pulls_url":"https://api.github.com/repos/portainer/portainer/pulls{/number}","milestones_url":"https://api.github.com/repos/portainer/portainer/milestones{/number}","notifications_url":"https://api.github.com/repos/portainer/portainer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/portainer/portainer/labels{/name}","releases_url":"https://api.github.com/repos/portainer/portainer/releases{/id}","deployments_url":"https://api.github.com/repos/portainer/portainer/deployments","created_at":"2016-05-19T20:15:28Z","updated_at":"2018-08-09T15:53:32Z","pushed_at":"2018-08-09T16:16:39Z","git_url":"git://github.com/portainer/portainer.git","ssh_url":"git@github.com:portainer/portainer.git","clone_url":"https://github.com/portainer/portainer.git","svn_url":"https://github.com/portainer/portainer","homepage":"http://portainer.io","size":17188,"stargazers_count":8868,"watchers_count":8868,"language":"HTML","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":861,"mirror_url":null,"archived":false,"open_issues_count":346,"license":{"key":"zlib","name":"zlib License","spdx_id":"Zlib","url":"https://api.github.com/licenses/zlib","node_id":"MDc6TGljZW5zZTI3"},"forks":861,"open_issues":346,"watchers":8868,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/portainer/portainer/pulls/2143"},"html":{"href":"https://github.com/portainer/portainer/pull/2143"},"issue":{"href":"https://api.github.com/repos/portainer/portainer/issues/2143"},"comments":{"href":"https://api.github.com/repos/portainer/portainer/issues/2143/comments"},"review_comments":{"href":"https://api.github.com/repos/portainer/portainer/pulls/2143/comments"},"review_comment":{"href":"https://api.github.com/repos/portainer/portainer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/portainer/portainer/pulls/2143/commits"},"statuses":{"href":"https://api.github.com/repos/portainer/portainer/statuses/65319501a3e0059a70dbd9a07fe81357baa776e8"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"deviantony"}}