{"action":"created","comment":{"url":"https://api.github.com/repos/rancherio/cattle/pulls/comments/28533509","id":28533509,"diff_hunk":"@@ -0,0 +1,81 @@\n+package io.cattle.platform.iaas.api.filter.snapshot;\n+\n+import io.cattle.platform.core.constants.SnapshotConstants;\n+import io.cattle.platform.core.model.Snapshot;\n+import io.cattle.platform.core.model.Volume;\n+import io.cattle.platform.iaas.api.filter.common.AbstractDefaultResourceManagerFilter;\n+import io.cattle.platform.object.ObjectManager;\n+import io.cattle.platform.object.util.DataUtils;\n+import io.github.ibuildthecloud.gdapi.exception.ValidationErrorException;\n+import io.github.ibuildthecloud.gdapi.request.ApiRequest;\n+import io.github.ibuildthecloud.gdapi.request.resource.ResourceManager;\n+import io.github.ibuildthecloud.gdapi.validation.ValidationErrorCodes;\n+\n+import javax.inject.Inject;\n+\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+\n+public class SnapshotFilter extends AbstractDefaultResourceManagerFilter {\n+\n+    private static final Logger log = LoggerFactory\n+            .getLogger(SnapshotFilter.class);\n+    ObjectManager objectManager;\n+\n+    @Override\n+    public String[] getTypes() {\n+        return new String[] { \"snapshot\" };\n+    }\n+\n+    @Override\n+    public Class<?>[] getTypeClasses() {\n+        return new Class<?>[] { Snapshot.class };\n+    }\n+\n+    @Inject\n+    public void setObjectManager(ObjectManager objectManager) {\n+        this.objectManager = objectManager;\n+    }\n+\n+    @Override\n+    public Object create(String type, ApiRequest request, ResourceManager next) {\n+        Long volumeId = DataUtils.getFieldFromRequest(request,","path":"code/iaas/api-logic/src/main/java/io/cattle/platform/iaas/api/filter/snapshot/SnapshotFilter.java","position":42,"original_position":42,"commit_id":"8fc9a782b8f30b032e18173e484ead28954b2645","original_commit_id":"8fc9a782b8f30b032e18173e484ead28954b2645","user":{"login":"ibuildthecloud","id":1754002,"avatar_url":"https://avatars.githubusercontent.com/u/1754002?v=3","gravatar_id":"","url":"https://api.github.com/users/ibuildthecloud","html_url":"https://github.com/ibuildthecloud","followers_url":"https://api.github.com/users/ibuildthecloud/followers","following_url":"https://api.github.com/users/ibuildthecloud/following{/other_user}","gists_url":"https://api.github.com/users/ibuildthecloud/gists{/gist_id}","starred_url":"https://api.github.com/users/ibuildthecloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ibuildthecloud/subscriptions","organizations_url":"https://api.github.com/users/ibuildthecloud/orgs","repos_url":"https://api.github.com/users/ibuildthecloud/repos","events_url":"https://api.github.com/users/ibuildthecloud/events{/privacy}","received_events_url":"https://api.github.com/users/ibuildthecloud/received_events","type":"User","site_admin":false},"body":"Don't need to check for null volume if volumeId is set to required in the API schema","created_at":"2015-04-16T17:55:28Z","updated_at":"2015-04-16T17:55:28Z","html_url":"https://github.com/rancherio/cattle/pull/348#discussion_r28533509","pull_request_url":"https://api.github.com/repos/rancherio/cattle/pulls/348","_links":{"self":{"href":"https://api.github.com/repos/rancherio/cattle/pulls/comments/28533509"},"html":{"href":"https://github.com/rancherio/cattle/pull/348#discussion_r28533509"},"pull_request":{"href":"https://api.github.com/repos/rancherio/cattle/pulls/348"}}},"pull_request":{"url":"https://api.github.com/repos/rancherio/cattle/pulls/348","id":33296620,"html_url":"https://github.com/rancherio/cattle/pull/348","diff_url":"https://github.com/rancherio/cattle/pull/348.diff","patch_url":"https://github.com/rancherio/cattle/pull/348.patch","issue_url":"https://api.github.com/repos/rancherio/cattle/issues/348","number":348,"state":"open","locked":false,"title":"Snapshot v2","user":{"login":"yasker","id":3344618,"avatar_url":"https://avatars.githubusercontent.com/u/3344618?v=3","gravatar_id":"","url":"https://api.github.com/users/yasker","html_url":"https://github.com/yasker","followers_url":"https://api.github.com/users/yasker/followers","following_url":"https://api.github.com/users/yasker/following{/other_user}","gists_url":"https://api.github.com/users/yasker/gists{/gist_id}","starred_url":"https://api.github.com/users/yasker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yasker/subscriptions","organizations_url":"https://api.github.com/users/yasker/orgs","repos_url":"https://api.github.com/users/yasker/repos","events_url":"https://api.github.com/users/yasker/events{/privacy}","received_events_url":"https://api.github.com/users/yasker/received_events","type":"User","site_admin":false},"body":"Still working on integration test.","created_at":"2015-04-14T20:30:55Z","updated_at":"2015-04-16T17:55:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c949b2cdde88dfb9149759d84f1f95798b96556f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rancherio/cattle/pulls/348/commits","review_comments_url":"https://api.github.com/repos/rancherio/cattle/pulls/348/comments","review_comment_url":"https://api.github.com/repos/rancherio/cattle/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rancherio/cattle/issues/348/comments","statuses_url":"https://api.github.com/repos/rancherio/cattle/statuses/8fc9a782b8f30b032e18173e484ead28954b2645","head":{"label":"yasker:snapshot_v2","ref":"snapshot_v2","sha":"8fc9a782b8f30b032e18173e484ead28954b2645","user":{"login":"yasker","id":3344618,"avatar_url":"https://avatars.githubusercontent.com/u/3344618?v=3","gravatar_id":"","url":"https://api.github.com/users/yasker","html_url":"https://github.com/yasker","followers_url":"https://api.github.com/users/yasker/followers","following_url":"https://api.github.com/users/yasker/following{/other_user}","gists_url":"https://api.github.com/users/yasker/gists{/gist_id}","starred_url":"https://api.github.com/users/yasker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yasker/subscriptions","organizations_url":"https://api.github.com/users/yasker/orgs","repos_url":"https://api.github.com/users/yasker/repos","events_url":"https://api.github.com/users/yasker/events{/privacy}","received_events_url":"https://api.github.com/users/yasker/received_events","type":"User","site_admin":false},"repo":{"id":29788638,"name":"cattle","full_name":"yasker/cattle","owner":{"login":"yasker","id":3344618,"avatar_url":"https://avatars.githubusercontent.com/u/3344618?v=3","gravatar_id":"","url":"https://api.github.com/users/yasker","html_url":"https://github.com/yasker","followers_url":"https://api.github.com/users/yasker/followers","following_url":"https://api.github.com/users/yasker/following{/other_user}","gists_url":"https://api.github.com/users/yasker/gists{/gist_id}","starred_url":"https://api.github.com/users/yasker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yasker/subscriptions","organizations_url":"https://api.github.com/users/yasker/orgs","repos_url":"https://api.github.com/users/yasker/repos","events_url":"https://api.github.com/users/yasker/events{/privacy}","received_events_url":"https://api.github.com/users/yasker/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yasker/cattle","description":"Infrastructure orchestration platform","fork":true,"url":"https://api.github.com/repos/yasker/cattle","forks_url":"https://api.github.com/repos/yasker/cattle/forks","keys_url":"https://api.github.com/repos/yasker/cattle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yasker/cattle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yasker/cattle/teams","hooks_url":"https://api.github.com/repos/yasker/cattle/hooks","issue_events_url":"https://api.github.com/repos/yasker/cattle/issues/events{/number}","events_url":"https://api.github.com/repos/yasker/cattle/events","assignees_url":"https://api.github.com/repos/yasker/cattle/assignees{/user}","branches_url":"https://api.github.com/repos/yasker/cattle/branches{/branch}","tags_url":"https://api.github.com/repos/yasker/cattle/tags","blobs_url":"https://api.github.com/repos/yasker/cattle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yasker/cattle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yasker/cattle/git/refs{/sha}","trees_url":"https://api.github.com/repos/yasker/cattle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yasker/cattle/statuses/{sha}","languages_url":"https://api.github.com/repos/yasker/cattle/languages","stargazers_url":"https://api.github.com/repos/yasker/cattle/stargazers","contributors_url":"https://api.github.com/repos/yasker/cattle/contributors","subscribers_url":"https://api.github.com/repos/yasker/cattle/subscribers","subscription_url":"https://api.github.com/repos/yasker/cattle/subscription","commits_url":"https://api.github.com/repos/yasker/cattle/commits{/sha}","git_commits_url":"https://api.github.com/repos/yasker/cattle/git/commits{/sha}","comments_url":"https://api.github.com/repos/yasker/cattle/comments{/number}","issue_comment_url":"https://api.github.com/repos/yasker/cattle/issues/comments{/number}","contents_url":"https://api.github.com/repos/yasker/cattle/contents/{+path}","compare_url":"https://api.github.com/repos/yasker/cattle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yasker/cattle/merges","archive_url":"https://api.github.com/repos/yasker/cattle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yasker/cattle/downloads","issues_url":"https://api.github.com/repos/yasker/cattle/issues{/number}","pulls_url":"https://api.github.com/repos/yasker/cattle/pulls{/number}","milestones_url":"https://api.github.com/repos/yasker/cattle/milestones{/number}","notifications_url":"https://api.github.com/repos/yasker/cattle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yasker/cattle/labels{/name}","releases_url":"https://api.github.com/repos/yasker/cattle/releases{/id}","created_at":"2015-01-24T19:27:47Z","updated_at":"2015-04-14T20:28:10Z","pushed_at":"2015-04-14T22:48:10Z","git_url":"git://github.com/yasker/cattle.git","ssh_url":"git@github.com:yasker/cattle.git","clone_url":"https://github.com/yasker/cattle.git","svn_url":"https://github.com/yasker/cattle","homepage":"","size":17128,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rancherio:master","ref":"master","sha":"e0e25f58de1c5140ed031a9bc7d7fc65d4557ea8","user":{"login":"rancherio","id":9343010,"avatar_url":"https://avatars.githubusercontent.com/u/9343010?v=3","gravatar_id":"","url":"https://api.github.com/users/rancherio","html_url":"https://github.com/rancherio","followers_url":"https://api.github.com/users/rancherio/followers","following_url":"https://api.github.com/users/rancherio/following{/other_user}","gists_url":"https://api.github.com/users/rancherio/gists{/gist_id}","starred_url":"https://api.github.com/users/rancherio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rancherio/subscriptions","organizations_url":"https://api.github.com/users/rancherio/orgs","repos_url":"https://api.github.com/users/rancherio/repos","events_url":"https://api.github.com/users/rancherio/events{/privacy}","received_events_url":"https://api.github.com/users/rancherio/received_events","type":"Organization","site_admin":false},"repo":{"id":18023059,"name":"cattle","full_name":"rancherio/cattle","owner":{"login":"rancherio","id":9343010,"avatar_url":"https://avatars.githubusercontent.com/u/9343010?v=3","gravatar_id":"","url":"https://api.github.com/users/rancherio","html_url":"https://github.com/rancherio","followers_url":"https://api.github.com/users/rancherio/followers","following_url":"https://api.github.com/users/rancherio/following{/other_user}","gists_url":"https://api.github.com/users/rancherio/gists{/gist_id}","starred_url":"https://api.github.com/users/rancherio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rancherio/subscriptions","organizations_url":"https://api.github.com/users/rancherio/orgs","repos_url":"https://api.github.com/users/rancherio/repos","events_url":"https://api.github.com/users/rancherio/events{/privacy}","received_events_url":"https://api.github.com/users/rancherio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rancherio/cattle","description":"Infrastructure orchestration platform","fork":false,"url":"https://api.github.com/repos/rancherio/cattle","forks_url":"https://api.github.com/repos/rancherio/cattle/forks","keys_url":"https://api.github.com/repos/rancherio/cattle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rancherio/cattle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rancherio/cattle/teams","hooks_url":"https://api.github.com/repos/rancherio/cattle/hooks","issue_events_url":"https://api.github.com/repos/rancherio/cattle/issues/events{/number}","events_url":"https://api.github.com/repos/rancherio/cattle/events","assignees_url":"https://api.github.com/repos/rancherio/cattle/assignees{/user}","branches_url":"https://api.github.com/repos/rancherio/cattle/branches{/branch}","tags_url":"https://api.github.com/repos/rancherio/cattle/tags","blobs_url":"https://api.github.com/repos/rancherio/cattle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rancherio/cattle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rancherio/cattle/git/refs{/sha}","trees_url":"https://api.github.com/repos/rancherio/cattle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rancherio/cattle/statuses/{sha}","languages_url":"https://api.github.com/repos/rancherio/cattle/languages","stargazers_url":"https://api.github.com/repos/rancherio/cattle/stargazers","contributors_url":"https://api.github.com/repos/rancherio/cattle/contributors","subscribers_url":"https://api.github.com/repos/rancherio/cattle/subscribers","subscription_url":"https://api.github.com/repos/rancherio/cattle/subscription","commits_url":"https://api.github.com/repos/rancherio/cattle/commits{/sha}","git_commits_url":"https://api.github.com/repos/rancherio/cattle/git/commits{/sha}","comments_url":"https://api.github.com/repos/rancherio/cattle/comments{/number}","issue_comment_url":"https://api.github.com/repos/rancherio/cattle/issues/comments{/number}","contents_url":"https://api.github.com/repos/rancherio/cattle/contents/{+path}","compare_url":"https://api.github.com/repos/rancherio/cattle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rancherio/cattle/merges","archive_url":"https://api.github.com/repos/rancherio/cattle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rancherio/cattle/downloads","issues_url":"https://api.github.com/repos/rancherio/cattle/issues{/number}","pulls_url":"https://api.github.com/repos/rancherio/cattle/pulls{/number}","milestones_url":"https://api.github.com/repos/rancherio/cattle/milestones{/number}","notifications_url":"https://api.github.com/repos/rancherio/cattle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rancherio/cattle/labels{/name}","releases_url":"https://api.github.com/repos/rancherio/cattle/releases{/id}","created_at":"2014-03-23T00:19:52Z","updated_at":"2015-04-16T15:15:27Z","pushed_at":"2015-04-16T16:43:12Z","git_url":"git://github.com/rancherio/cattle.git","ssh_url":"git@github.com:rancherio/cattle.git","clone_url":"https://github.com/rancherio/cattle.git","svn_url":"https://github.com/rancherio/cattle","homepage":"","size":22915,"stargazers_count":126,"watchers_count":126,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":28,"mirror_url":null,"open_issues_count":86,"forks":28,"open_issues":86,"watchers":126,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rancherio/cattle/pulls/348"},"html":{"href":"https://github.com/rancherio/cattle/pull/348"},"issue":{"href":"https://api.github.com/repos/rancherio/cattle/issues/348"},"comments":{"href":"https://api.github.com/repos/rancherio/cattle/issues/348/comments"},"review_comments":{"href":"https://api.github.com/repos/rancherio/cattle/pulls/348/comments"},"review_comment":{"href":"https://api.github.com/repos/rancherio/cattle/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rancherio/cattle/pulls/348/commits"},"statuses":{"href":"https://api.github.com/repos/rancherio/cattle/statuses/8fc9a782b8f30b032e18173e484ead28954b2645"}}}}