use of com.netflix.spinnaker.halyard.core.problem.v1.Problem.Severity in project halyard by spinnaker.
the class ProviderController method setProvider.
@RequestMapping(value = "/{providerName:.+}", method = RequestMethod.PUT)
DaemonTask<Halconfig, Void> setProvider(@PathVariable String deploymentName, @PathVariable String providerName, @RequestParam(required = false, defaultValue = DefaultControllerValues.validate) boolean validate, @RequestParam(required = false, defaultValue = DefaultControllerValues.severity) Severity severity, @RequestBody Object rawProvider) {
Provider provider = objectMapper.convertValue(rawProvider, Providers.translateProviderType(providerName));
UpdateRequestBuilder builder = new UpdateRequestBuilder();
Path configPath = halconfigDirectoryStructure.getConfigPath(deploymentName);
builder.setStage(() -> provider.stageLocalFiles(configPath));
builder.setUpdate(() -> providerService.setProvider(deploymentName, provider));
builder.setSeverity(severity);
Supplier<ProblemSet> doValidate = ProblemSet::new;
if (validate) {
doValidate = () -> providerService.validateProvider(deploymentName, providerName);
}
builder.setValidate(doValidate);
builder.setRevert(() -> halconfigParser.undoChanges());
builder.setSave(() -> halconfigParser.saveConfig());
builder.setClean(() -> halconfigParser.cleanLocalFiles(configPath));
return DaemonTaskHandler.submitTask(builder::build, "Edit the " + providerName + " provider");
}
use of com.netflix.spinnaker.halyard.core.problem.v1.Problem.Severity in project halyard by spinnaker.
the class SecurityController method setMethodEnabled.
@RequestMapping(value = "/authz/enabled/", method = RequestMethod.PUT)
DaemonTask<Halconfig, Void> setMethodEnabled(@PathVariable String deploymentName, @RequestParam(required = false, defaultValue = DefaultControllerValues.validate) boolean validate, @RequestParam(required = false, defaultValue = DefaultControllerValues.severity) Severity severity, @RequestBody boolean enabled) {
UpdateRequestBuilder builder = new UpdateRequestBuilder();
builder.setUpdate(() -> securityService.setAuthzEnabled(deploymentName, enabled));
builder.setSeverity(severity);
builder.setValidate(ProblemSet::new);
if (validate) {
builder.setValidate(() -> securityService.validateAuthz(deploymentName));
}
builder.setRevert(() -> halconfigParser.undoChanges());
builder.setSave(() -> halconfigParser.saveConfig());
return DaemonTaskHandler.submitTask(builder::build, "Edit authorization settings");
}
use of com.netflix.spinnaker.halyard.core.problem.v1.Problem.Severity in project halyard by spinnaker.
the class SecurityController method setGroupMembership.
@RequestMapping(value = "/authz/groupMembership", method = RequestMethod.PUT)
DaemonTask<Halconfig, Void> setGroupMembership(@PathVariable String deploymentName, @RequestParam(required = false, defaultValue = DefaultControllerValues.validate) boolean validate, @RequestParam(required = false, defaultValue = DefaultControllerValues.severity) Severity severity, @RequestBody Object rawMembership) {
GroupMembership membership = objectMapper.convertValue(rawMembership, GroupMembership.class);
UpdateRequestBuilder builder = new UpdateRequestBuilder();
Path configPath = halconfigDirectoryStructure.getConfigPath(deploymentName);
builder.setStage(() -> membership.stageLocalFiles(configPath));
builder.setSeverity(severity);
builder.setUpdate(() -> securityService.setGroupMembership(deploymentName, membership));
builder.setValidate(ProblemSet::new);
if (validate) {
builder.setValidate(() -> securityService.validateAuthz(deploymentName));
}
builder.setRevert(() -> halconfigParser.undoChanges());
builder.setSave(() -> halconfigParser.saveConfig());
builder.setClean(() -> halconfigParser.cleanLocalFiles(configPath));
return DaemonTaskHandler.submitTask(builder::build, "Edit group membership settings");
}
use of com.netflix.spinnaker.halyard.core.problem.v1.Problem.Severity in project halyard by spinnaker.
the class SecurityController method setSpringSSl.
@RequestMapping(value = "/api/ssl/", method = RequestMethod.PUT)
DaemonTask<Halconfig, Void> setSpringSSl(@PathVariable String deploymentName, @RequestParam(required = false, defaultValue = DefaultControllerValues.validate) boolean validate, @RequestParam(required = false, defaultValue = DefaultControllerValues.severity) Severity severity, @RequestBody Object rawSpringSsl) {
SpringSsl apacheSsl = objectMapper.convertValue(rawSpringSsl, SpringSsl.class);
UpdateRequestBuilder builder = new UpdateRequestBuilder();
Path configPath = halconfigDirectoryStructure.getConfigPath(deploymentName);
builder.setStage(() -> apacheSsl.stageLocalFiles(configPath));
builder.setSeverity(severity);
builder.setUpdate(() -> securityService.setSpringSsl(deploymentName, apacheSsl));
builder.setValidate(ProblemSet::new);
if (validate) {
builder.setValidate(() -> securityService.validateSpringSsl(deploymentName));
}
builder.setRevert(() -> halconfigParser.undoChanges());
builder.setSave(() -> halconfigParser.saveConfig());
builder.setClean(() -> halconfigParser.cleanLocalFiles(configPath));
return DaemonTaskHandler.submitTask(builder::build, "Edit API SSL settings");
}
use of com.netflix.spinnaker.halyard.core.problem.v1.Problem.Severity in project halyard by spinnaker.
the class SecurityController method setApacheSSlEnabled.
@RequestMapping(value = "/ui/ssl/enabled/", method = RequestMethod.PUT)
DaemonTask<Halconfig, Void> setApacheSSlEnabled(@PathVariable String deploymentName, @RequestParam(required = false, defaultValue = DefaultControllerValues.validate) boolean validate, @RequestParam(required = false, defaultValue = DefaultControllerValues.severity) Severity severity, @RequestBody boolean enabled) {
UpdateRequestBuilder builder = new UpdateRequestBuilder();
builder.setSeverity(severity);
builder.setUpdate(() -> securityService.setApacheSslEnabled(deploymentName, enabled));
builder.setValidate(ProblemSet::new);
if (validate) {
builder.setValidate(() -> securityService.validateApacheSsl(deploymentName));
}
builder.setRevert(() -> halconfigParser.undoChanges());
builder.setSave(() -> halconfigParser.saveConfig());
return DaemonTaskHandler.submitTask(builder::build, "Edit UI SSL settings");
}
Aggregations