@RequestMapping(value = "/{deploymentName:.+}/deploy/", method = RequestMethod.POST)
DaemonTask<Halconfig, RemoteAction> deploy(@PathVariable String deploymentName,
@ModelAttribute ValidationSettings validationSettings,
@RequestParam(required = false) List<DeployOption> deployOptions,
@RequestParam(required = false) List<String> serviceNames,
@RequestParam(required = false) List<String> excludeServiceNames) {
List<DeployOption> finalDeployOptions =
deployOptions != null ? deployOptions : Collections.emptyList();
List<String> finalServiceNames = serviceNames != null ? serviceNames : Collections.emptyList();
List<String> finalExcludeServiceNames =
excludeServiceNames != null ? excludeServiceNames : Collections.emptyList();
StaticRequestBuilder<RemoteAction> builder = new StaticRequestBuilder<>(
() -> deployService.deploy(deploymentName, finalDeployOptions,
finalServiceNames, finalExcludeServiceNames));
builder.setSeverity(validationSettings.getSeverity());
if (validationSettings.isValidate()) {
builder.setValidateResponse(() -> deploymentService.validateDeployment(deploymentName));
}
return DaemonTaskHandler
.submitTask(builder::build, "Apply deployment", TimeUnit.MINUTES.toMillis(30));
}