{"action":"created","comment":{"url":"https://api.github.com/repos/spinnaker/front50/pulls/comments/78198563","id":78198563,"diff_hunk":"@@ -0,0 +1,163 @@\n+package com.netflix.spinnaker.front50.controllers.v2\n+\n+import com.netflix.spectator.api.Registry\n+import com.netflix.spinnaker.front50.events.ApplicationEventListener\n+import com.netflix.spinnaker.front50.exception.InvalidApplicationRequestException\n+import com.netflix.spinnaker.front50.exception.NotFoundException\n+import com.netflix.spinnaker.front50.model.application.Application\n+import com.netflix.spinnaker.front50.model.application.ApplicationDAO\n+import com.netflix.spinnaker.front50.model.notification.NotificationDAO\n+import com.netflix.spinnaker.front50.model.pipeline.PipelineDAO\n+import com.netflix.spinnaker.front50.model.pipeline.PipelineStrategyDAO\n+import com.netflix.spinnaker.front50.model.project.ProjectDAO\n+import com.netflix.spinnaker.front50.validator.ApplicationValidator\n+import groovy.util.logging.Slf4j\n+import io.swagger.annotations.Api\n+import io.swagger.annotations.ApiOperation\n+import org.springframework.beans.factory.annotation.Autowired\n+import org.springframework.context.MessageSource\n+import org.springframework.context.i18n.LocaleContextHolder\n+import org.springframework.http.HttpStatus\n+import org.springframework.security.access.AccessDeniedException\n+import org.springframework.security.access.prepost.PostFilter\n+import org.springframework.security.access.prepost.PreAuthorize\n+import org.springframework.validation.Errors\n+import org.springframework.validation.ObjectError\n+import org.springframework.web.bind.annotation.*\n+\n+import javax.servlet.http.HttpServletResponse\n+\n+@Slf4j\n+@RestController\n+@RequestMapping(\"/v2/applications\")\n+@Api(value = \"application\", description = \"Application API\")\n+public class ApplicationsControllerV2 {\n+  @Autowired\n+  MessageSource messageSource\n+\n+  @Autowired\n+  ApplicationDAO applicationDAO\n+\n+  @Autowired\n+  ProjectDAO projectDAO\n+\n+  @Autowired\n+  NotificationDAO notificationDAO\n+\n+  @Autowired\n+  PipelineDAO pipelineDAO\n+\n+  @Autowired\n+  PipelineStrategyDAO pipelineStrategyDAO\n+\n+  @Autowired\n+  List<ApplicationValidator> applicationValidators\n+\n+  @Autowired(required = false)\n+  List<ApplicationEventListener> applicationEventListeners = []\n+\n+  @Autowired\n+  Registry registry\n+\n+  @PreAuthorize(\"@fiatPermissionEvaluator.storeWholePermission()\")\n+  @PostFilter(\"hasPermission(filterObject.name, 'APPLICATION', 'READ')\")\n+  @ApiOperation(value = \"\", notes = \"\"\"Fetch all applications.\n+\n+    Supports filtering by one or more attributes:\n+    - ?email=my@email.com\n+    - ?email=my@email.com&name=flex\"\"\")\n+  @RequestMapping(method = RequestMethod.GET)\n+  Set<Application> applications(@RequestParam Map<String, String> params) {\n+    if (params.isEmpty()) {\n+      return applicationDAO.all()\n+    }\n+\n+    return applicationDAO.search(params)\n+  }\n+\n+  @PreAuthorize(\"hasPermission(#app.name, 'APPLICATION', 'CREATE')\")\n+  @ApiOperation(value = \"\", notes = \"Create an application\")\n+  @RequestMapping(method = RequestMethod.POST, value = \"\")\n+  Application create(@RequestBody final Application app) {\n+    return getApplication().initialize(app).withName(app.getName()).save()\n+  }\n+\n+  @PreAuthorize(\"hasPermission(#application, 'APPLICATION', 'WRITE')\")\n+  @ApiOperation(value = \"\", notes = \"Delete an application\")\n+  @RequestMapping(method = RequestMethod.DELETE, value = \"/{application}\")\n+  void delete(@PathVariable String application, HttpServletResponse response) {\n+    getApplication().initialize(new Application().withName(application)).delete()\n+    response.setStatus(HttpStatus.ACCEPTED.value())\n+  }\n+\n+  @PreAuthorize(\"hasPermission(#app.name, 'APPLICATION', 'WRITE')\")\n+  @ApiOperation(value = \"\", notes = \"Update an existing application\")\n+  @RequestMapping(method = RequestMethod.PUT, value = \"/{name}\")","path":"front50-web/src/main/groovy/com/netflix/spinnaker/front50/controllers/v2/ApplicationsControllerV2.groovy","position":95,"original_position":95,"commit_id":"fe26dde18c6c2454eed9a085008a2e19da84d371","original_commit_id":"fe26dde18c6c2454eed9a085008a2e19da84d371","user":{"login":"ajordens","id":388652,"avatar_url":"https://avatars.githubusercontent.com/u/388652?v=3","gravatar_id":"","url":"https://api.github.com/users/ajordens","html_url":"https://github.com/ajordens","followers_url":"https://api.github.com/users/ajordens/followers","following_url":"https://api.github.com/users/ajordens/following{/other_user}","gists_url":"https://api.github.com/users/ajordens/gists{/gist_id}","starred_url":"https://api.github.com/users/ajordens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajordens/subscriptions","organizations_url":"https://api.github.com/users/ajordens/orgs","repos_url":"https://api.github.com/users/ajordens/repos","events_url":"https://api.github.com/users/ajordens/events{/privacy}","received_events_url":"https://api.github.com/users/ajordens/received_events","type":"User","site_admin":false},"body":"Coming from a dropwizard background, `@RequestMapping` still throws me for a loop.\r\n\r\nI look forward to `PostMapping` and `GetMapping` (even tho I'd argue that `@GET` and `@POST` are even better :)).","created_at":"2016-09-09T15:21:52Z","updated_at":"2016-09-09T15:21:52Z","html_url":"https://github.com/spinnaker/front50/pull/130#discussion_r78198563","pull_request_url":"https://api.github.com/repos/spinnaker/front50/pulls/130","_links":{"self":{"href":"https://api.github.com/repos/spinnaker/front50/pulls/comments/78198563"},"html":{"href":"https://github.com/spinnaker/front50/pull/130#discussion_r78198563"},"pull_request":{"href":"https://api.github.com/repos/spinnaker/front50/pulls/130"}}},"pull_request":{"url":"https://api.github.com/repos/spinnaker/front50/pulls/130","id":84562911,"html_url":"https://github.com/spinnaker/front50/pull/130","diff_url":"https://github.com/spinnaker/front50/pull/130.diff","patch_url":"https://github.com/spinnaker/front50/pull/130.patch","issue_url":"https://api.github.com/repos/spinnaker/front50/issues/130","number":130,"state":"open","locked":false,"title":"Add V2 Application API endpoints","user":{"login":"jeyrschabu","id":1572759,"avatar_url":"https://avatars.githubusercontent.com/u/1572759?v=3","gravatar_id":"","url":"https://api.github.com/users/jeyrschabu","html_url":"https://github.com/jeyrschabu","followers_url":"https://api.github.com/users/jeyrschabu/followers","following_url":"https://api.github.com/users/jeyrschabu/following{/other_user}","gists_url":"https://api.github.com/users/jeyrschabu/gists{/gist_id}","starred_url":"https://api.github.com/users/jeyrschabu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeyrschabu/subscriptions","organizations_url":"https://api.github.com/users/jeyrschabu/orgs","repos_url":"https://api.github.com/users/jeyrschabu/repos","events_url":"https://api.github.com/users/jeyrschabu/events{/privacy}","received_events_url":"https://api.github.com/users/jeyrschabu/received_events","type":"User","site_admin":false},"body":"Added a V2 API for application with minor tweaks & cleanup.\r\n@ajordens ","created_at":"2016-09-08T22:09:08Z","updated_at":"2016-09-09T15:21:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e009ba2dfc100aaf7f239b98e699d769e124f6e2","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/spinnaker/front50/pulls/130/commits","review_comments_url":"https://api.github.com/repos/spinnaker/front50/pulls/130/comments","review_comment_url":"https://api.github.com/repos/spinnaker/front50/pulls/comments{/number}","comments_url":"https://api.github.com/repos/spinnaker/front50/issues/130/comments","statuses_url":"https://api.github.com/repos/spinnaker/front50/statuses/fe26dde18c6c2454eed9a085008a2e19da84d371","head":{"label":"jeyrschabu:application_api_v2","ref":"application_api_v2","sha":"fe26dde18c6c2454eed9a085008a2e19da84d371","user":{"login":"jeyrschabu","id":1572759,"avatar_url":"https://avatars.githubusercontent.com/u/1572759?v=3","gravatar_id":"","url":"https://api.github.com/users/jeyrschabu","html_url":"https://github.com/jeyrschabu","followers_url":"https://api.github.com/users/jeyrschabu/followers","following_url":"https://api.github.com/users/jeyrschabu/following{/other_user}","gists_url":"https://api.github.com/users/jeyrschabu/gists{/gist_id}","starred_url":"https://api.github.com/users/jeyrschabu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeyrschabu/subscriptions","organizations_url":"https://api.github.com/users/jeyrschabu/orgs","repos_url":"https://api.github.com/users/jeyrschabu/repos","events_url":"https://api.github.com/users/jeyrschabu/events{/privacy}","received_events_url":"https://api.github.com/users/jeyrschabu/received_events","type":"User","site_admin":false},"repo":{"id":67555694,"name":"front50","full_name":"jeyrschabu/front50","owner":{"login":"jeyrschabu","id":1572759,"avatar_url":"https://avatars.githubusercontent.com/u/1572759?v=3","gravatar_id":"","url":"https://api.github.com/users/jeyrschabu","html_url":"https://github.com/jeyrschabu","followers_url":"https://api.github.com/users/jeyrschabu/followers","following_url":"https://api.github.com/users/jeyrschabu/following{/other_user}","gists_url":"https://api.github.com/users/jeyrschabu/gists{/gist_id}","starred_url":"https://api.github.com/users/jeyrschabu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeyrschabu/subscriptions","organizations_url":"https://api.github.com/users/jeyrschabu/orgs","repos_url":"https://api.github.com/users/jeyrschabu/repos","events_url":"https://api.github.com/users/jeyrschabu/events{/privacy}","received_events_url":"https://api.github.com/users/jeyrschabu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jeyrschabu/front50","description":"Cross-Application Persistence Service","fork":true,"url":"https://api.github.com/repos/jeyrschabu/front50","forks_url":"https://api.github.com/repos/jeyrschabu/front50/forks","keys_url":"https://api.github.com/repos/jeyrschabu/front50/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jeyrschabu/front50/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jeyrschabu/front50/teams","hooks_url":"https://api.github.com/repos/jeyrschabu/front50/hooks","issue_events_url":"https://api.github.com/repos/jeyrschabu/front50/issues/events{/number}","events_url":"https://api.github.com/repos/jeyrschabu/front50/events","assignees_url":"https://api.github.com/repos/jeyrschabu/front50/assignees{/user}","branches_url":"https://api.github.com/repos/jeyrschabu/front50/branches{/branch}","tags_url":"https://api.github.com/repos/jeyrschabu/front50/tags","blobs_url":"https://api.github.com/repos/jeyrschabu/front50/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jeyrschabu/front50/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jeyrschabu/front50/git/refs{/sha}","trees_url":"https://api.github.com/repos/jeyrschabu/front50/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jeyrschabu/front50/statuses/{sha}","languages_url":"https://api.github.com/repos/jeyrschabu/front50/languages","stargazers_url":"https://api.github.com/repos/jeyrschabu/front50/stargazers","contributors_url":"https://api.github.com/repos/jeyrschabu/front50/contributors","subscribers_url":"https://api.github.com/repos/jeyrschabu/front50/subscribers","subscription_url":"https://api.github.com/repos/jeyrschabu/front50/subscription","commits_url":"https://api.github.com/repos/jeyrschabu/front50/commits{/sha}","git_commits_url":"https://api.github.com/repos/jeyrschabu/front50/git/commits{/sha}","comments_url":"https://api.github.com/repos/jeyrschabu/front50/comments{/number}","issue_comment_url":"https://api.github.com/repos/jeyrschabu/front50/issues/comments{/number}","contents_url":"https://api.github.com/repos/jeyrschabu/front50/contents/{+path}","compare_url":"https://api.github.com/repos/jeyrschabu/front50/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jeyrschabu/front50/merges","archive_url":"https://api.github.com/repos/jeyrschabu/front50/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jeyrschabu/front50/downloads","issues_url":"https://api.github.com/repos/jeyrschabu/front50/issues{/number}","pulls_url":"https://api.github.com/repos/jeyrschabu/front50/pulls{/number}","milestones_url":"https://api.github.com/repos/jeyrschabu/front50/milestones{/number}","notifications_url":"https://api.github.com/repos/jeyrschabu/front50/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jeyrschabu/front50/labels{/name}","releases_url":"https://api.github.com/repos/jeyrschabu/front50/releases{/id}","deployments_url":"https://api.github.com/repos/jeyrschabu/front50/deployments","created_at":"2016-09-06T23:58:20Z","updated_at":"2016-09-06T23:58:22Z","pushed_at":"2016-09-08T22:53:41Z","git_url":"git://github.com/jeyrschabu/front50.git","ssh_url":"git@github.com:jeyrschabu/front50.git","clone_url":"https://github.com/jeyrschabu/front50.git","svn_url":"https://github.com/jeyrschabu/front50","homepage":"","size":828,"stargazers_count":0,"watchers_count":0,"language":"Groovy","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":"master"}},"base":{"label":"spinnaker:master","ref":"master","sha":"ed46b40436f992274e5d41810e38c030e92328d9","user":{"login":"spinnaker","id":7634182,"avatar_url":"https://avatars.githubusercontent.com/u/7634182?v=3","gravatar_id":"","url":"https://api.github.com/users/spinnaker","html_url":"https://github.com/spinnaker","followers_url":"https://api.github.com/users/spinnaker/followers","following_url":"https://api.github.com/users/spinnaker/following{/other_user}","gists_url":"https://api.github.com/users/spinnaker/gists{/gist_id}","starred_url":"https://api.github.com/users/spinnaker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spinnaker/subscriptions","organizations_url":"https://api.github.com/users/spinnaker/orgs","repos_url":"https://api.github.com/users/spinnaker/repos","events_url":"https://api.github.com/users/spinnaker/events{/privacy}","received_events_url":"https://api.github.com/users/spinnaker/received_events","type":"Organization","site_admin":false},"repo":{"id":21367721,"name":"front50","full_name":"spinnaker/front50","owner":{"login":"spinnaker","id":7634182,"avatar_url":"https://avatars.githubusercontent.com/u/7634182?v=3","gravatar_id":"","url":"https://api.github.com/users/spinnaker","html_url":"https://github.com/spinnaker","followers_url":"https://api.github.com/users/spinnaker/followers","following_url":"https://api.github.com/users/spinnaker/following{/other_user}","gists_url":"https://api.github.com/users/spinnaker/gists{/gist_id}","starred_url":"https://api.github.com/users/spinnaker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spinnaker/subscriptions","organizations_url":"https://api.github.com/users/spinnaker/orgs","repos_url":"https://api.github.com/users/spinnaker/repos","events_url":"https://api.github.com/users/spinnaker/events{/privacy}","received_events_url":"https://api.github.com/users/spinnaker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/spinnaker/front50","description":"Cross-Application Persistence Service","fork":false,"url":"https://api.github.com/repos/spinnaker/front50","forks_url":"https://api.github.com/repos/spinnaker/front50/forks","keys_url":"https://api.github.com/repos/spinnaker/front50/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spinnaker/front50/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spinnaker/front50/teams","hooks_url":"https://api.github.com/repos/spinnaker/front50/hooks","issue_events_url":"https://api.github.com/repos/spinnaker/front50/issues/events{/number}","events_url":"https://api.github.com/repos/spinnaker/front50/events","assignees_url":"https://api.github.com/repos/spinnaker/front50/assignees{/user}","branches_url":"https://api.github.com/repos/spinnaker/front50/branches{/branch}","tags_url":"https://api.github.com/repos/spinnaker/front50/tags","blobs_url":"https://api.github.com/repos/spinnaker/front50/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spinnaker/front50/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spinnaker/front50/git/refs{/sha}","trees_url":"https://api.github.com/repos/spinnaker/front50/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spinnaker/front50/statuses/{sha}","languages_url":"https://api.github.com/repos/spinnaker/front50/languages","stargazers_url":"https://api.github.com/repos/spinnaker/front50/stargazers","contributors_url":"https://api.github.com/repos/spinnaker/front50/contributors","subscribers_url":"https://api.github.com/repos/spinnaker/front50/subscribers","subscription_url":"https://api.github.com/repos/spinnaker/front50/subscription","commits_url":"https://api.github.com/repos/spinnaker/front50/commits{/sha}","git_commits_url":"https://api.github.com/repos/spinnaker/front50/git/commits{/sha}","comments_url":"https://api.github.com/repos/spinnaker/front50/comments{/number}","issue_comment_url":"https://api.github.com/repos/spinnaker/front50/issues/comments{/number}","contents_url":"https://api.github.com/repos/spinnaker/front50/contents/{+path}","compare_url":"https://api.github.com/repos/spinnaker/front50/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spinnaker/front50/merges","archive_url":"https://api.github.com/repos/spinnaker/front50/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spinnaker/front50/downloads","issues_url":"https://api.github.com/repos/spinnaker/front50/issues{/number}","pulls_url":"https://api.github.com/repos/spinnaker/front50/pulls{/number}","milestones_url":"https://api.github.com/repos/spinnaker/front50/milestones{/number}","notifications_url":"https://api.github.com/repos/spinnaker/front50/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spinnaker/front50/labels{/name}","releases_url":"https://api.github.com/repos/spinnaker/front50/releases{/id}","deployments_url":"https://api.github.com/repos/spinnaker/front50/deployments","created_at":"2014-06-30T22:17:10Z","updated_at":"2016-09-09T15:15:51Z","pushed_at":"2016-09-08T22:53:41Z","git_url":"git://github.com/spinnaker/front50.git","ssh_url":"git@github.com:spinnaker/front50.git","clone_url":"https://github.com/spinnaker/front50.git","svn_url":"https://github.com/spinnaker/front50","homepage":"","size":1090,"stargazers_count":13,"watchers_count":13,"language":"Groovy","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":43,"mirror_url":null,"open_issues_count":2,"forks":43,"open_issues":2,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/spinnaker/front50/pulls/130"},"html":{"href":"https://github.com/spinnaker/front50/pull/130"},"issue":{"href":"https://api.github.com/repos/spinnaker/front50/issues/130"},"comments":{"href":"https://api.github.com/repos/spinnaker/front50/issues/130/comments"},"review_comments":{"href":"https://api.github.com/repos/spinnaker/front50/pulls/130/comments"},"review_comment":{"href":"https://api.github.com/repos/spinnaker/front50/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/spinnaker/front50/pulls/130/commits"},"statuses":{"href":"https://api.github.com/repos/spinnaker/front50/statuses/fe26dde18c6c2454eed9a085008a2e19da84d371"}}}}
{"actor":{"display_login":"ajordens"}}