Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(pipelines): Add simple api operation descriptions to /bakery, /c… #386

Merged
merged 1 commit into from
May 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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