Skip to content

Commit

Permalink
feat(provider/aws): Added a new API, to get the lambda functions. (#859)
Browse files Browse the repository at this point in the history
  • Loading branch information
madhusarma authored and asher committed Sep 27, 2019
1 parent 878649f commit 40af409
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -383,4 +383,12 @@ interface ClouddriverService {
@Query(value = "region") String region,
@Query(value = "serviceInstanceName") String serviceInstanceName)

@GET(value = "/functions")
List<Map> getFunctions(@Query(value = "functionName") String functionName,
@Query(value = "region") String region,
@Query(value = "account") String account)

@GET("/applications/{name}/functions")
List<Map> getApplicationFunctions(@Path("name") String appName)

}
1 change: 1 addition & 0 deletions gate-web/config/gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ swagger:
- .*version.*
- .*pubsub.*
- .*projects.*
- .*functions.*

integrations:
gremlin:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ package com.netflix.spinnaker.gate.controllers.aws
import com.netflix.spinnaker.gate.services.aws.InfrastructureService
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
import org.springframework.web.bind.annotation.RequestMethod
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.RestController

@RestController
Expand Down Expand Up @@ -53,4 +55,18 @@ class AmazonInfrastructureController {
List<Map> vpcs() {
infrastructureService.vpcs
}

@ApiOperation(value = "Get functions", response = List.class)
@RequestMapping(value = "/functions", method = RequestMethod.GET)
List<Map> functions(@RequestParam(value = "functionName", required = false) String functionName,
@RequestParam(value = "region", required = false) String region,
@RequestParam(value = "account", required = false) String account) {
infrastructureService.getFunctions(functionName, region, account)
}

@ApiOperation(value = "Get application functions", response = List.class)
@RequestMapping(value = "/applications/{application}/functions", method = RequestMethod.GET)
List<Map> applicationFunctions(@PathVariable String application) {
infrastructureService.getApplicationFunctions(application)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,16 @@ class InfrastructureService {
clouddriverServiceSelector.select(selectorKey).getNetworks('aws')
} execute()
}

List<Map> getFunctions(String selectorKey = null, String functionName, String region, String account) {
command("functions") {
clouddriverServiceSelector.select(selectorKey).getFunctions(functionName,region, account)
} execute()
}

List<Map> getApplicationFunctions(String selectorKey = null, String application) {
command("functions") {
clouddriverServiceSelector.select(selectorKey).getApplicationFunctions(application)
} execute()
}
}

0 comments on commit 40af409

Please sign in to comment.