Search in sources :

Example 16 with Severity

use of com.netflix.spinnaker.halyard.core.problem.v1.Problem.Severity in project halyard by spinnaker.

the class MasterController method addMaster.

@RequestMapping(value = "/", method = RequestMethod.POST)
DaemonTask<Halconfig, Void> addMaster(@PathVariable String deploymentName, @PathVariable String ciName, @RequestParam(required = false, defaultValue = DefaultControllerValues.validate) boolean validate, @RequestParam(required = false, defaultValue = DefaultControllerValues.severity) Severity severity, @RequestBody Object rawMaster) {
    Master master = objectMapper.convertValue(rawMaster, Cis.translateMasterType(ciName));
    UpdateRequestBuilder builder = new UpdateRequestBuilder();
    Path configPath = halconfigDirectoryStructure.getConfigPath(deploymentName);
    builder.setStage(() -> master.stageLocalFiles(configPath));
    builder.setSeverity(severity);
    builder.setUpdate(() -> masterService.addMaster(deploymentName, ciName, master));
    Supplier<ProblemSet> doValidate = ProblemSet::new;
    if (validate) {
        doValidate = () -> masterService.validateMaster(deploymentName, ciName, master.getName());
    }
    builder.setValidate(doValidate);
    builder.setRevert(() -> halconfigParser.undoChanges());
    builder.setSave(() -> halconfigParser.saveConfig());
    builder.setClean(() -> halconfigParser.cleanLocalFiles(configPath));
    return DaemonTaskHandler.submitTask(builder::build, "Add the " + master.getName() + " master");
}
Also used : Master(com.netflix.spinnaker.halyard.config.model.v1.node.Master) Path(java.nio.file.Path) 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 17 with Severity

use of com.netflix.spinnaker.halyard.core.problem.v1.Problem.Severity in project halyard by spinnaker.

the class NotificationController method setEnabled.

@RequestMapping(value = "/{notificationName:.+}/enabled", method = RequestMethod.PUT)
DaemonTask<Halconfig, Void> setEnabled(@PathVariable String deploymentName, @PathVariable String notificationName, @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(() -> notificationService.setEnabled(deploymentName, notificationName, enabled));
    builder.setSeverity(severity);
    Supplier<ProblemSet> doValidate = ProblemSet::new;
    if (validate) {
        doValidate = () -> notificationService.validateNotification(deploymentName, notificationName);
    }
    builder.setValidate(doValidate);
    builder.setRevert(() -> halconfigParser.undoChanges());
    builder.setSave(() -> halconfigParser.saveConfig());
    return DaemonTaskHandler.submitTask(builder::build, "Edit " + notificationName + " 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 18 with Severity

use of com.netflix.spinnaker.halyard.core.problem.v1.Problem.Severity in project halyard by spinnaker.

the class ProviderController method setEnabled.

@RequestMapping(value = "/{providerName:.+}/enabled", method = RequestMethod.PUT)
DaemonTask<Halconfig, Void> setEnabled(@PathVariable String deploymentName, @PathVariable String providerName, @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(() -> providerService.setEnabled(deploymentName, providerName, enabled));
    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());
    return DaemonTaskHandler.submitTask(builder::build, "Edit the " + providerName + " provider");
}
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 19 with Severity

use of com.netflix.spinnaker.halyard.core.problem.v1.Problem.Severity in project halyard by spinnaker.

the class SecurityController method setUiSecurity.

@RequestMapping(value = "/ui/", method = RequestMethod.PUT)
DaemonTask<Halconfig, Void> setUiSecurity(@PathVariable String deploymentName, @RequestParam(required = false, defaultValue = DefaultControllerValues.validate) boolean validate, @RequestParam(required = false, defaultValue = DefaultControllerValues.severity) Severity severity, @RequestBody Object rawUiSecurity) {
    UiSecurity uiSecurity = objectMapper.convertValue(rawUiSecurity, UiSecurity.class);
    UpdateRequestBuilder builder = new UpdateRequestBuilder();
    Path configPath = halconfigDirectoryStructure.getConfigPath(deploymentName);
    builder.setStage(() -> uiSecurity.stageLocalFiles(configPath));
    builder.setSeverity(severity);
    builder.setUpdate(() -> securityService.setUiSecurity(deploymentName, uiSecurity));
    builder.setValidate(ProblemSet::new);
    if (validate) {
        builder.setValidate(() -> securityService.validateUiSecurity(deploymentName));
    }
    builder.setRevert(() -> halconfigParser.undoChanges());
    builder.setSave(() -> halconfigParser.saveConfig());
    builder.setClean(() -> halconfigParser.cleanLocalFiles(configPath));
    return DaemonTaskHandler.submitTask(builder::build, "Edit UI security settings");
}
Also used : Path(java.nio.file.Path) UiSecurity(com.netflix.spinnaker.halyard.config.model.v1.security.UiSecurity) 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 20 with Severity

use of com.netflix.spinnaker.halyard.core.problem.v1.Problem.Severity in project halyard by spinnaker.

the class SecurityController method setRoleProvider.

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

Aggregations

ProblemSet (com.netflix.spinnaker.halyard.core.problem.v1.ProblemSet)52 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)52 UpdateRequestBuilder (com.netflix.spinnaker.halyard.core.DaemonResponse.UpdateRequestBuilder)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 Cluster (com.netflix.spinnaker.halyard.config.model.v1.node.Cluster)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 DaemonResponse (com.netflix.spinnaker.halyard.core.DaemonResponse)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