{"action":"created","comment":{"url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/pulls/comments/197020799","pull_request_review_id":130678253,"id":197020799,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NzAyMDc5OQ==","diff_hunk":"@@ -248,5 +258,65 @@ private Document GetDocumentById(string id)\n \n             return null;\n         }\n+\n+        public async Task Delete(List<string> ids)\n+        {\n+            Task[] taskList = new Task[ids.Count];\n+            for (int i = 0; i < ids.Count; i++)\n+            {\n+                taskList[i] = this.DeleteAsync(ids[i]);\n+            }\n+\n+            try\n+            {\n+                await Task.WhenAll(taskList);\n+            }\n+            catch (AggregateException aggregateException)\n+            {\n+                Exception inner = aggregateException.InnerExceptions[0];\n+                this.log.Error(\"Failed to delete alarm\", () => new { inner });\n+                throw inner;\n+            }\n+        }\n+\n+        /**\n+         * Delete an individual alarm by id. If the delete fails for a DocumentClientException\n+         * other than not found, retry up to this.maxRetryCount\n+         */\n+        public async Task DeleteAsync(string id)\n+        {\n+            int retryCount = 0;\n+            while (retryCount < this.maxDeleteRetryCount)\n+            {\n+                try\n+                {\n+                    await this.storageClient.DeleteDocumentAsync(\n+                        this.databaseName,\n+                        this.collectionId,\n+                        id);\n+                    return;\n+                }\n+                catch (DocumentClientException e)\n+                {\n+                    // already deleted\n+                    if (e.StatusCode == HttpStatusCode.NotFound)","path":"Services/Alarms.cs","position":91,"original_position":91,"commit_id":"3178a4ce3c8fb1d960087e3bec52134e2165ad90","original_commit_id":"3178a4ce3c8fb1d960087e3bec52134e2165ad90","user":{"login":"dluc","id":371009,"node_id":"MDQ6VXNlcjM3MTAwOQ==","avatar_url":"https://avatars2.githubusercontent.com/u/371009?v=4","gravatar_id":"","url":"https://api.github.com/users/dluc","html_url":"https://github.com/dluc","followers_url":"https://api.github.com/users/dluc/followers","following_url":"https://api.github.com/users/dluc/following{/other_user}","gists_url":"https://api.github.com/users/dluc/gists{/gist_id}","starred_url":"https://api.github.com/users/dluc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dluc/subscriptions","organizations_url":"https://api.github.com/users/dluc/orgs","repos_url":"https://api.github.com/users/dluc/repos","events_url":"https://api.github.com/users/dluc/events{/privacy}","received_events_url":"https://api.github.com/users/dluc/received_events","type":"User","site_admin":false},"body":"sorry, what I was actually suggesting was the following, because we still need to wrap generic exceptions with ExternalDependencyException:\r\n\r\n```\r\ncatch (DocumentClientException e) when (e.StatusCode == HttpStatusCode.NotFound) {\r\n    return\r\n}\r\ncatch (Exception e) {\r\n   ...retry...\r\n   throw new ExternalDependencyException(e);\r\n}\r\n","created_at":"2018-06-21T06:13:40Z","updated_at":"2018-06-21T06:13:40Z","html_url":"https://github.com/Azure/device-telemetry-dotnet/pull/84#discussion_r197020799","pull_request_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/pulls/84","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/Azure/device-telemetry-dotnet/pulls/comments/197020799"},"html":{"href":"https://github.com/Azure/device-telemetry-dotnet/pull/84#discussion_r197020799"},"pull_request":{"href":"https://api.github.com/repos/Azure/device-telemetry-dotnet/pulls/84"}}},"pull_request":{"url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/pulls/84","id":193467454,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkzNDY3NDU0","html_url":"https://github.com/Azure/device-telemetry-dotnet/pull/84","diff_url":"https://github.com/Azure/device-telemetry-dotnet/pull/84.diff","patch_url":"https://github.com/Azure/device-telemetry-dotnet/pull/84.patch","issue_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/issues/84","number":84,"state":"open","locked":false,"title":"Add delete alarm by id API","user":{"login":"molly-moen","id":33666587,"node_id":"MDQ6VXNlcjMzNjY2NTg3","avatar_url":"https://avatars1.githubusercontent.com/u/33666587?v=4","gravatar_id":"","url":"https://api.github.com/users/molly-moen","html_url":"https://github.com/molly-moen","followers_url":"https://api.github.com/users/molly-moen/followers","following_url":"https://api.github.com/users/molly-moen/following{/other_user}","gists_url":"https://api.github.com/users/molly-moen/gists{/gist_id}","starred_url":"https://api.github.com/users/molly-moen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/molly-moen/subscriptions","organizations_url":"https://api.github.com/users/molly-moen/orgs","repos_url":"https://api.github.com/users/molly-moen/repos","events_url":"https://api.github.com/users/molly-moen/events{/privacy}","received_events_url":"https://api.github.com/users/molly-moen/received_events","type":"User","site_admin":false},"body":"# Type of change? <!-- [x] all the boxes that apply -->\r\n\r\n- [ ] Bug fix\r\n- [x] New feature\r\n- [ ] Enhancement\r\n- [ ] Breaking change (breaks backward compatibility)\r\n\r\n# Description, Context, Motivation <!-- Please help us reviewing your PR -->\r\nAdd API to alarms to delete alarms by a list of alarm ids, up to a maximum of 1000 alarms.\r\n\r\nSample request:\r\nPOST .../telemetry/v1/alarms/delete\r\nBody:\r\n{\r\n\t\"Ids\": [\"977b5193-9e0f-410a-f57a-a1363cc4b87c\", \"a36d4da6-a0d9-366b-4fb9-f4d10439c2c5\", \"870f182d-3aac-bc07-6894-674bf7977192\", \"03d80e5f-93e7-205c-1074-7a51143d54d2\"]\r\n}\r\n\r\nResponse: 200 OK\r\n**Checklist:**\r\n\r\n- [x] All tests passed\r\n- [x] The code follows the code style and conventions of this project\r\n- [x] The change requires a change to the documentation\r\n- [ ] I have updated the documentation accordingly\r\nWill update API wiki after merged.","created_at":"2018-06-07T22:45:52Z","updated_at":"2018-06-21T06:13:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ac62f11f63c98358389ae30f3638dd8983928925","assignee":null,"assignees":[],"requested_reviewers":[{"login":"jillcary","id":3317135,"node_id":"MDQ6VXNlcjMzMTcxMzU=","avatar_url":"https://avatars1.githubusercontent.com/u/3317135?v=4","gravatar_id":"","url":"https://api.github.com/users/jillcary","html_url":"https://github.com/jillcary","followers_url":"https://api.github.com/users/jillcary/followers","following_url":"https://api.github.com/users/jillcary/following{/other_user}","gists_url":"https://api.github.com/users/jillcary/gists{/gist_id}","starred_url":"https://api.github.com/users/jillcary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jillcary/subscriptions","organizations_url":"https://api.github.com/users/jillcary/orgs","repos_url":"https://api.github.com/users/jillcary/repos","events_url":"https://api.github.com/users/jillcary/events{/privacy}","received_events_url":"https://api.github.com/users/jillcary/received_events","type":"User","site_admin":false},{"login":"timlaverty","id":5084013,"node_id":"MDQ6VXNlcjUwODQwMTM=","avatar_url":"https://avatars2.githubusercontent.com/u/5084013?v=4","gravatar_id":"","url":"https://api.github.com/users/timlaverty","html_url":"https://github.com/timlaverty","followers_url":"https://api.github.com/users/timlaverty/followers","following_url":"https://api.github.com/users/timlaverty/following{/other_user}","gists_url":"https://api.github.com/users/timlaverty/gists{/gist_id}","starred_url":"https://api.github.com/users/timlaverty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timlaverty/subscriptions","organizations_url":"https://api.github.com/users/timlaverty/orgs","repos_url":"https://api.github.com/users/timlaverty/repos","events_url":"https://api.github.com/users/timlaverty/events{/privacy}","received_events_url":"https://api.github.com/users/timlaverty/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/pulls/84/commits","review_comments_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/pulls/84/comments","review_comment_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/issues/84/comments","statuses_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/statuses/3178a4ce3c8fb1d960087e3bec52134e2165ad90","head":{"label":"Azure:momoe/delete-alarms-by-id","ref":"momoe/delete-alarms-by-id","sha":"3178a4ce3c8fb1d960087e3bec52134e2165ad90","user":{"login":"Azure","id":6844498,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY4NDQ0OTg=","avatar_url":"https://avatars0.githubusercontent.com/u/6844498?v=4","gravatar_id":"","url":"https://api.github.com/users/Azure","html_url":"https://github.com/Azure","followers_url":"https://api.github.com/users/Azure/followers","following_url":"https://api.github.com/users/Azure/following{/other_user}","gists_url":"https://api.github.com/users/Azure/gists{/gist_id}","starred_url":"https://api.github.com/users/Azure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Azure/subscriptions","organizations_url":"https://api.github.com/users/Azure/orgs","repos_url":"https://api.github.com/users/Azure/repos","events_url":"https://api.github.com/users/Azure/events{/privacy}","received_events_url":"https://api.github.com/users/Azure/received_events","type":"Organization","site_admin":false},"repo":{"id":94933957,"node_id":"MDEwOlJlcG9zaXRvcnk5NDkzMzk1Nw==","name":"device-telemetry-dotnet","full_name":"Azure/device-telemetry-dotnet","owner":{"login":"Azure","id":6844498,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY4NDQ0OTg=","avatar_url":"https://avatars0.githubusercontent.com/u/6844498?v=4","gravatar_id":"","url":"https://api.github.com/users/Azure","html_url":"https://github.com/Azure","followers_url":"https://api.github.com/users/Azure/followers","following_url":"https://api.github.com/users/Azure/following{/other_user}","gists_url":"https://api.github.com/users/Azure/gists{/gist_id}","starred_url":"https://api.github.com/users/Azure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Azure/subscriptions","organizations_url":"https://api.github.com/users/Azure/orgs","repos_url":"https://api.github.com/users/Azure/repos","events_url":"https://api.github.com/users/Azure/events{/privacy}","received_events_url":"https://api.github.com/users/Azure/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Azure/device-telemetry-dotnet","description":"Device telemetry implementation in .NET for PCS","fork":false,"url":"https://api.github.com/repos/Azure/device-telemetry-dotnet","forks_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/forks","keys_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/teams","hooks_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/hooks","issue_events_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/issues/events{/number}","events_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/events","assignees_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/assignees{/user}","branches_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/branches{/branch}","tags_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/tags","blobs_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/git/refs{/sha}","trees_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/statuses/{sha}","languages_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/languages","stargazers_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/stargazers","contributors_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/contributors","subscribers_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/subscribers","subscription_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/subscription","commits_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/commits{/sha}","git_commits_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/git/commits{/sha}","comments_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/comments{/number}","issue_comment_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/issues/comments{/number}","contents_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/contents/{+path}","compare_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/merges","archive_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/downloads","issues_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/issues{/number}","pulls_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/pulls{/number}","milestones_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/milestones{/number}","notifications_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/labels{/name}","releases_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/releases{/id}","deployments_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/deployments","created_at":"2017-06-20T20:51:02Z","updated_at":"2018-06-05T18:51:36Z","pushed_at":"2018-06-20T23:29:58Z","git_url":"git://github.com/Azure/device-telemetry-dotnet.git","ssh_url":"git@github.com:Azure/device-telemetry-dotnet.git","clone_url":"https://github.com/Azure/device-telemetry-dotnet.git","svn_url":"https://github.com/Azure/device-telemetry-dotnet","homepage":null,"size":258,"stargazers_count":4,"watchers_count":4,"language":"C#","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"archived":false,"open_issues_count":13,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":10,"open_issues":13,"watchers":4,"default_branch":"master"}},"base":{"label":"Azure:master","ref":"master","sha":"58ebe758db422ca7e9bce2cfd353d02546fd49f8","user":{"login":"Azure","id":6844498,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY4NDQ0OTg=","avatar_url":"https://avatars0.githubusercontent.com/u/6844498?v=4","gravatar_id":"","url":"https://api.github.com/users/Azure","html_url":"https://github.com/Azure","followers_url":"https://api.github.com/users/Azure/followers","following_url":"https://api.github.com/users/Azure/following{/other_user}","gists_url":"https://api.github.com/users/Azure/gists{/gist_id}","starred_url":"https://api.github.com/users/Azure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Azure/subscriptions","organizations_url":"https://api.github.com/users/Azure/orgs","repos_url":"https://api.github.com/users/Azure/repos","events_url":"https://api.github.com/users/Azure/events{/privacy}","received_events_url":"https://api.github.com/users/Azure/received_events","type":"Organization","site_admin":false},"repo":{"id":94933957,"node_id":"MDEwOlJlcG9zaXRvcnk5NDkzMzk1Nw==","name":"device-telemetry-dotnet","full_name":"Azure/device-telemetry-dotnet","owner":{"login":"Azure","id":6844498,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY4NDQ0OTg=","avatar_url":"https://avatars0.githubusercontent.com/u/6844498?v=4","gravatar_id":"","url":"https://api.github.com/users/Azure","html_url":"https://github.com/Azure","followers_url":"https://api.github.com/users/Azure/followers","following_url":"https://api.github.com/users/Azure/following{/other_user}","gists_url":"https://api.github.com/users/Azure/gists{/gist_id}","starred_url":"https://api.github.com/users/Azure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Azure/subscriptions","organizations_url":"https://api.github.com/users/Azure/orgs","repos_url":"https://api.github.com/users/Azure/repos","events_url":"https://api.github.com/users/Azure/events{/privacy}","received_events_url":"https://api.github.com/users/Azure/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Azure/device-telemetry-dotnet","description":"Device telemetry implementation in .NET for PCS","fork":false,"url":"https://api.github.com/repos/Azure/device-telemetry-dotnet","forks_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/forks","keys_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/teams","hooks_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/hooks","issue_events_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/issues/events{/number}","events_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/events","assignees_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/assignees{/user}","branches_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/branches{/branch}","tags_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/tags","blobs_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/git/refs{/sha}","trees_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/statuses/{sha}","languages_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/languages","stargazers_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/stargazers","contributors_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/contributors","subscribers_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/subscribers","subscription_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/subscription","commits_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/commits{/sha}","git_commits_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/git/commits{/sha}","comments_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/comments{/number}","issue_comment_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/issues/comments{/number}","contents_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/contents/{+path}","compare_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/merges","archive_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/downloads","issues_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/issues{/number}","pulls_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/pulls{/number}","milestones_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/milestones{/number}","notifications_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/labels{/name}","releases_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/releases{/id}","deployments_url":"https://api.github.com/repos/Azure/device-telemetry-dotnet/deployments","created_at":"2017-06-20T20:51:02Z","updated_at":"2018-06-05T18:51:36Z","pushed_at":"2018-06-20T23:29:58Z","git_url":"git://github.com/Azure/device-telemetry-dotnet.git","ssh_url":"git@github.com:Azure/device-telemetry-dotnet.git","clone_url":"https://github.com/Azure/device-telemetry-dotnet.git","svn_url":"https://github.com/Azure/device-telemetry-dotnet","homepage":null,"size":258,"stargazers_count":4,"watchers_count":4,"language":"C#","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"archived":false,"open_issues_count":13,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":10,"open_issues":13,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Azure/device-telemetry-dotnet/pulls/84"},"html":{"href":"https://github.com/Azure/device-telemetry-dotnet/pull/84"},"issue":{"href":"https://api.github.com/repos/Azure/device-telemetry-dotnet/issues/84"},"comments":{"href":"https://api.github.com/repos/Azure/device-telemetry-dotnet/issues/84/comments"},"review_comments":{"href":"https://api.github.com/repos/Azure/device-telemetry-dotnet/pulls/84/comments"},"review_comment":{"href":"https://api.github.com/repos/Azure/device-telemetry-dotnet/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Azure/device-telemetry-dotnet/pulls/84/commits"},"statuses":{"href":"https://api.github.com/repos/Azure/device-telemetry-dotnet/statuses/3178a4ce3c8fb1d960087e3bec52134e2165ad90"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"dluc"}}