Skip to content

Commit

Permalink
docs(pipelines): Add simple api operation descriptions to /bakery, /c…
Browse files Browse the repository at this point in the history
…redentials, /networks and /subnets entry-points.
  • Loading branch information
Matt Duftler committed May 8, 2017
1 parent 5864ac2 commit 3622db1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<ClouddriverService.Account> 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<Map> allByCloudProvider(@PathVariable String cloudProvider) {
networkService.getNetworks(cloudProvider)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<Map> allByCloudProvider(@PathVariable String cloudProvider) {
clouddriverService.getSubnets(cloudProvider)
Expand Down

0 comments on commit 3622db1

Please sign in to comment.