Search in sources :

Example 46 with UpdateRequestBuilder

use of com.netflix.spinnaker.halyard.core.DaemonResponse.UpdateRequestBuilder 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");
}
Also used : Path(java.nio.file.Path) UpdateRequestBuilder(com.netflix.spinnaker.halyard.core.DaemonResponse.UpdateRequestBuilder) GroupMembership(com.netflix.spinnaker.halyard.config.model.v1.security.GroupMembership) ProblemSet(com.netflix.spinnaker.halyard.core.problem.v1.ProblemSet) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 47 with UpdateRequestBuilder

use of com.netflix.spinnaker.halyard.core.DaemonResponse.UpdateRequestBuilder 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");
}
Also used : Path(java.nio.file.Path) UpdateRequestBuilder(com.netflix.spinnaker.halyard.core.DaemonResponse.UpdateRequestBuilder) SpringSsl(com.netflix.spinnaker.halyard.config.model.v1.security.SpringSsl) ProblemSet(com.netflix.spinnaker.halyard.core.problem.v1.ProblemSet) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 48 with UpdateRequestBuilder

use of com.netflix.spinnaker.halyard.core.DaemonResponse.UpdateRequestBuilder 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");
}
Also used : UpdateRequestBuilder(com.netflix.spinnaker.halyard.core.DaemonResponse.UpdateRequestBuilder) ProblemSet(com.netflix.spinnaker.halyard.core.problem.v1.ProblemSet) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 49 with UpdateRequestBuilder

use of com.netflix.spinnaker.halyard.core.DaemonResponse.UpdateRequestBuilder in project halyard by spinnaker.

the class SecurityController method setApacheSSl.

@RequestMapping(value = "/ui/ssl/", method = RequestMethod.PUT)
DaemonTask<Halconfig, Void> setApacheSSl(@PathVariable String deploymentName, @RequestParam(required = false, defaultValue = DefaultControllerValues.validate) boolean validate, @RequestParam(required = false, defaultValue = DefaultControllerValues.severity) Severity severity, @RequestBody Object rawApacheSsl) {
    ApacheSsl apacheSsl = objectMapper.convertValue(rawApacheSsl, ApacheSsl.class);
    UpdateRequestBuilder builder = new UpdateRequestBuilder();
    Path configPath = halconfigDirectoryStructure.getConfigPath(deploymentName);
    builder.setStage(() -> apacheSsl.stageLocalFiles(configPath));
    builder.setSeverity(severity);
    builder.setUpdate(() -> securityService.setApacheSsl(deploymentName, apacheSsl));
    builder.setValidate(ProblemSet::new);
    if (validate) {
        builder.setValidate(() -> securityService.validateApacheSsl(deploymentName));
    }
    builder.setRevert(() -> halconfigParser.undoChanges());
    builder.setSave(() -> halconfigParser.saveConfig());
    builder.setClean(() -> halconfigParser.cleanLocalFiles(configPath));
    return DaemonTaskHandler.submitTask(builder::build, "Edit UI SSL settings");
}
Also used : Path(java.nio.file.Path) ApacheSsl(com.netflix.spinnaker.halyard.config.model.v1.security.ApacheSsl) UpdateRequestBuilder(com.netflix.spinnaker.halyard.core.DaemonResponse.UpdateRequestBuilder) ProblemSet(com.netflix.spinnaker.halyard.core.problem.v1.ProblemSet) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 50 with UpdateRequestBuilder

use of com.netflix.spinnaker.halyard.core.DaemonResponse.UpdateRequestBuilder in project halyard by spinnaker.

the class SecurityController method setApiSecurity.

@RequestMapping(value = "/api/", method = RequestMethod.PUT)
DaemonTask<Halconfig, Void> setApiSecurity(@PathVariable String deploymentName, @RequestParam(required = false, defaultValue = DefaultControllerValues.validate) boolean validate, @RequestParam(required = false, defaultValue = DefaultControllerValues.severity) Severity severity, @RequestBody Object rawApiSecurity) {
    ApiSecurity apiSecurity = objectMapper.convertValue(rawApiSecurity, ApiSecurity.class);
    UpdateRequestBuilder builder = new UpdateRequestBuilder();
    Path configPath = halconfigDirectoryStructure.getConfigPath(deploymentName);
    builder.setStage(() -> apiSecurity.stageLocalFiles(configPath));
    builder.setSeverity(severity);
    builder.setUpdate(() -> securityService.setApiSecurity(deploymentName, apiSecurity));
    builder.setValidate(ProblemSet::new);
    if (validate) {
        builder.setValidate(() -> securityService.validateApiSecurity(deploymentName));
    }
    builder.setRevert(() -> halconfigParser.undoChanges());
    builder.setSave(() -> halconfigParser.saveConfig());
    builder.setClean(() -> halconfigParser.cleanLocalFiles(configPath));
    return DaemonTaskHandler.submitTask(builder::build, "Edit API security settings");
}
Also used : Path(java.nio.file.Path) UpdateRequestBuilder(com.netflix.spinnaker.halyard.core.DaemonResponse.UpdateRequestBuilder) ApiSecurity(com.netflix.spinnaker.halyard.config.model.v1.security.ApiSecurity) ProblemSet(com.netflix.spinnaker.halyard.core.problem.v1.ProblemSet) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

UpdateRequestBuilder (com.netflix.spinnaker.halyard.core.DaemonResponse.UpdateRequestBuilder)50 ProblemSet (com.netflix.spinnaker.halyard.core.problem.v1.ProblemSet)50 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)50 Path (java.nio.file.Path)37 AbstractCanaryAccount (com.netflix.spinnaker.halyard.config.model.v1.canary.AbstractCanaryAccount)2 Account (com.netflix.spinnaker.halyard.config.model.v1.node.Account)2 ArtifactAccount (com.netflix.spinnaker.halyard.config.model.v1.node.ArtifactAccount)2 BaseImage (com.netflix.spinnaker.halyard.config.model.v1.node.BaseImage)2 Master (com.netflix.spinnaker.halyard.config.model.v1.node.Master)2 Subscription (com.netflix.spinnaker.halyard.config.model.v1.node.Subscription)2 ApiSecurity (com.netflix.spinnaker.halyard.config.model.v1.security.ApiSecurity)2 UiSecurity (com.netflix.spinnaker.halyard.config.model.v1.security.UiSecurity)2 Canary (com.netflix.spinnaker.halyard.config.model.v1.canary.Canary)1 ArtifactProvider (com.netflix.spinnaker.halyard.config.model.v1.node.ArtifactProvider)1 BakeryDefaults (com.netflix.spinnaker.halyard.config.model.v1.node.BakeryDefaults)1 DeploymentConfiguration (com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration)1 DeploymentEnvironment (com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentEnvironment)1 Features (com.netflix.spinnaker.halyard.config.model.v1.node.Features)1 MetricStore (com.netflix.spinnaker.halyard.config.model.v1.node.MetricStore)1 MetricStores (com.netflix.spinnaker.halyard.config.model.v1.node.MetricStores)1