use of com.netflix.spinnaker.halyard.config.model.v1.security.SpringSsl in project halyard by spinnaker.
the class SpringSslEditCommand method executeThis.
@Override
protected void executeThis() {
String currentDeployment = getCurrentDeployment();
SpringSsl springSsl = new OperationHandler<SpringSsl>().setOperation(Daemon.getSpringSsl(currentDeployment, false)).setFailureMesssage("Failed to load SSL settings.").get();
int originalHash = springSsl.hashCode();
springSsl.setKeyAlias(isSet(keyAlias) ? keyAlias : springSsl.getKeyAlias());
springSsl.setKeyStore(isSet(keyStore) ? keyStore : springSsl.getKeyStore());
springSsl.setKeyStoreType(isSet(keyStoreType) ? keyStoreType : springSsl.getKeyStoreType());
springSsl.setKeyStorePassword(isSet(keyStorePassword) ? keyStorePassword : springSsl.getKeyStorePassword());
springSsl.setTrustStore(isSet(trustStore) ? trustStore : springSsl.getTrustStore());
springSsl.setTrustStoreType(isSet(trustStoreType) ? trustStoreType : springSsl.getTrustStoreType());
springSsl.setTrustStorePassword(isSet(trustStorePassword) ? trustStorePassword : springSsl.getTrustStorePassword());
springSsl.setClientAuth(isSet(clientAuth) ? clientAuth : springSsl.getClientAuth());
if (originalHash == springSsl.hashCode()) {
AnsiUi.failure("No changes supplied.");
return;
}
new OperationHandler<Void>().setOperation(Daemon.setSpringSsl(currentDeployment, !noValidate, springSsl)).setFailureMesssage("Failed to edit SSL settings.").setFailureMesssage("Successfully updated SSL settings.").get();
}
use of com.netflix.spinnaker.halyard.config.model.v1.security.SpringSsl 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");
}
Aggregations