Skip to content

Commit

Permalink
feat(keel): endpoints for delivery config manifests
Browse files Browse the repository at this point in the history
  • Loading branch information
robfletcher committed Sep 7, 2019
1 parent c03528d commit cb7995b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package com.netflix.spinnaker.gate.services.internal;

import com.netflix.spinnaker.kork.manageddelivery.model.DeliveryConfig;
import com.netflix.spinnaker.kork.manageddelivery.model.Resource;
import com.netflix.spinnaker.kork.manageddelivery.model.ResourceEvent;
import java.util.List;
Expand All @@ -42,6 +43,12 @@ public interface KeelService {
@DELETE("/resources/{name}")
Resource deleteResource(@Path("name") String name);

@GET("/delivery-configs/{name}")
DeliveryConfig getManifest(@Path("name") String name);

@POST("/delivery-configs")
DeliveryConfig upsertManifest(@Body DeliveryConfig manifest);

@GET("/application/{application}")
Map getApplicationDetails(
@Path("application") String application, @Query("includeDetails") Boolean includeDetails);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package com.netflix.spinnaker.gate.controllers;

import static org.springframework.web.bind.annotation.RequestMethod.DELETE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;

import com.netflix.spinnaker.gate.services.internal.KeelService;
import com.netflix.spinnaker.kork.manageddelivery.model.DeliveryConfig;
import com.netflix.spinnaker.kork.manageddelivery.model.Resource;
import groovy.util.logging.Slf4j;
import io.swagger.annotations.ApiOperation;
Expand All @@ -12,7 +17,6 @@
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
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;

Expand All @@ -31,25 +35,39 @@ public ManagedController(KeelService keelService) {
}

@ApiOperation(value = "Get a resource", response = Resource.class)
@RequestMapping(value = "/resources/{name}", method = RequestMethod.GET)
@RequestMapping(value = "/resources/{name}", method = GET)
Resource getResource(@PathVariable("name") String name) {
return keelService.getResource(name);
}

@ApiOperation(value = "Create or update a resource", response = Resource.class)
@RequestMapping(value = "/resources", method = RequestMethod.POST)
@RequestMapping(value = "/resources", method = POST)
Resource upsertResource(@RequestBody Resource resource) {
return keelService.upsertResource(resource);
}

@ApiOperation(value = "Delete a resource", response = Resource.class)
@RequestMapping(value = "/resources/{name}", method = RequestMethod.DELETE)
@RequestMapping(value = "/resources/{name}", method = DELETE)
Resource deleteResource(@PathVariable("name") String name) {
return keelService.deleteResource(name);
}

@ApiOperation(value = "Get a delivery config manifest", response = DeliveryConfig.class)
@RequestMapping(value = "/delivery-configs/{name}", method = GET)
DeliveryConfig getManifest(@PathVariable("name") String name) {
return keelService.getManifest(name);
}

@ApiOperation(
value = "Create or update a delivery config manifest",
response = DeliveryConfig.class)
@RequestMapping(value = "/delivery-configs", method = POST)
DeliveryConfig upsertManifest(@RequestBody DeliveryConfig manifest) {
return keelService.upsertManifest(manifest);
}

@ApiOperation(value = "Get managed details about an application", response = Map.class)
@RequestMapping(value = "/application/{application}", method = RequestMethod.GET)
@RequestMapping(value = "/application/{application}", method = GET)
Map getApplicationDetails(
@PathVariable("application") String application,
@RequestParam(value = "includeDetails", required = false, defaultValue = "false")
Expand Down

0 comments on commit cb7995b

Please sign in to comment.