use of com.netflix.spinnaker.front50.model.delivery.Delivery in project front50 by spinnaker.
the class DeliveryController method deleteConfig.
@PreAuthorize("hasPermission(#application, 'APPLICATION', 'WRITE')")
@ApiOperation(value = "", notes = "Delete a delivery config")
@RequestMapping(method = RequestMethod.DELETE, value = "/applications/{application}/deliveries/{id}")
void deleteConfig(@PathVariable String application, @PathVariable String id) {
Delivery config = deliveryRepository.findById(id);
if (!config.getApplication().equals(application)) {
throw new InvalidRequestException("No config with id " + id + " found in application " + application);
}
deliveryRepository.delete(id);
}
use of com.netflix.spinnaker.front50.model.delivery.Delivery in project front50 by spinnaker.
the class DeliveryController method upsertConfig.
@PreAuthorize("hasPermission(#config.application, 'APPLICATION', 'WRITE')")
@ApiOperation(value = "", notes = "Update a delivery config")
@RequestMapping(method = RequestMethod.PUT, value = "/deliveries/{id}")
Delivery upsertConfig(@PathVariable String id, @RequestBody Delivery config) {
if (!id.equals(config.getId())) {
throw new InvalidRequestException("URL id (" + id + ") does not match submitted id (" + config.getId() + ")");
}
try {
Delivery existing = deliveryRepository.findById(id);
config.setCreateTs(existing.getCreateTs());
} catch (NotFoundException e) {
// ignore because we will create config
}
return deliveryRepository.upsertConfig(config);
}
Aggregations