From 558af9f03137c32c3708ac518c4accb40fefad59 Mon Sep 17 00:00:00 2001 From: Matt Duftler Date: Fri, 5 May 2017 06:37:14 -0400 Subject: [PATCH] docs(pipelines): Add simple api operation descriptions to /bakery, /credentials, /networks and /subnets entry-points. --- .../netflix/spinnaker/gate/controllers/BakeController.groovy | 4 ++++ .../spinnaker/gate/controllers/CredentialsController.groovy | 3 +++ .../spinnaker/gate/controllers/NetworkController.groovy | 3 +++ .../spinnaker/gate/controllers/SubnetController.groovy | 2 ++ 4 files changed, 12 insertions(+) diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/BakeController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/BakeController.groovy index 4d7d39ecea..1d7aaedf83 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/BakeController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/BakeController.groovy @@ -17,6 +17,7 @@ package com.netflix.spinnaker.gate.controllers import com.netflix.spinnaker.gate.services.BakeService +import io.swagger.annotations.ApiOperation import org.springframework.beans.factory.annotation.Autowired import org.springframework.http.HttpStatus import org.springframework.web.bind.annotation.ExceptionHandler @@ -34,16 +35,19 @@ class BakeController { @Autowired BakeService bakeService + @ApiOperation(value = "Retrieve a list of available bakery base images, grouped by cloud provider") @RequestMapping(value = "/options", method = RequestMethod.GET) def bakeOptions() { bakeService.bakeOptions() } + @ApiOperation(value = "Retrieve a list of available bakery base images for a given cloud provider") @RequestMapping(value = "/options/{cloudProvider}", method = RequestMethod.GET) def bakeOptions(@PathVariable("cloudProvider") String cloudProvider) { bakeService.bakeOptions(cloudProvider) } + @ApiOperation(value = "Retrieve the logs for a given bake") @RequestMapping(value = "/logs/{region}/{statusId}", method = RequestMethod.GET) def lookupLogs(@PathVariable("region") String region, @PathVariable("statusId") String statusId) { diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/CredentialsController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/CredentialsController.groovy index 816a3e59e1..156dd1e831 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/CredentialsController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/CredentialsController.groovy @@ -20,6 +20,7 @@ import com.netflix.spinnaker.gate.security.SpinnakerUser import com.netflix.spinnaker.gate.services.CredentialsService import com.netflix.spinnaker.gate.services.internal.ClouddriverService import com.netflix.spinnaker.security.User +import io.swagger.annotations.ApiOperation import org.springframework.beans.factory.annotation.Autowired import org.springframework.security.access.prepost.PostFilter import org.springframework.security.access.prepost.PreAuthorize @@ -37,12 +38,14 @@ class CredentialsController { @PreAuthorize("@fiatPermissionEvaluator.storeWholePermission()") @PostFilter("hasPermission(filterObject.name, 'ACCOUNT', 'READ')") + @ApiOperation(value = "Retrieve a list of accounts") @RequestMapping(method = RequestMethod.GET) List getAccounts(@SpinnakerUser User user) { credentialsService.getAccounts(user?.roles ?: []) } @PreAuthorize("hasPermission(#account, 'ACCOUNT', 'READ')") + @ApiOperation(value = "Retrieve an account's details") @RequestMapping(value = '/{account}', method = RequestMethod.GET) Map getAccount(@PathVariable("account") String account) { credentialsService.getAccount(account) diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/NetworkController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/NetworkController.groovy index c8cee58eed..683fb93a58 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/NetworkController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/NetworkController.groovy @@ -17,6 +17,7 @@ package com.netflix.spinnaker.gate.controllers import com.netflix.spinnaker.gate.services.NetworkService +import io.swagger.annotations.ApiOperation import org.springframework.beans.factory.annotation.Autowired import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestMapping @@ -30,11 +31,13 @@ class NetworkController { @Autowired NetworkService networkService + @ApiOperation(value = "Retrieve a list of networks, grouped by cloud provider") @RequestMapping(method = RequestMethod.GET) Map all() { networkService.getNetworks() } + @ApiOperation(value = "Retrieve a list of networks for a given cloud provider") @RequestMapping(value = "/{cloudProvider}", method = RequestMethod.GET) List allByCloudProvider(@PathVariable String cloudProvider) { networkService.getNetworks(cloudProvider) diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/SubnetController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/SubnetController.groovy index 669d8339f9..e16e4ea2e0 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/SubnetController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/SubnetController.groovy @@ -17,6 +17,7 @@ package com.netflix.spinnaker.gate.controllers import com.netflix.spinnaker.gate.services.internal.ClouddriverService +import io.swagger.annotations.ApiOperation import org.springframework.beans.factory.annotation.Autowired import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestMapping @@ -30,6 +31,7 @@ class SubnetController { @Autowired ClouddriverService clouddriverService + @ApiOperation(value = "Retrieve a list of subnets for a given cloud provider") @RequestMapping(value = "/{cloudProvider}", method = RequestMethod.GET) List allByCloudProvider(@PathVariable String cloudProvider) { clouddriverService.getSubnets(cloudProvider)