Search in sources :

Example 6 with ProblemSet

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

the class DeploymentController method deploymentConfiguration.

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

Example 7 with ProblemSet

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

the class FeaturesController method setFeatures.

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

Example 8 with ProblemSet

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

the class MetricStoresController method setMetricStore.

@RequestMapping(value = "/{metricStoreType:.+}", method = RequestMethod.PUT)
DaemonTask<Halconfig, Void> setMetricStore(@PathVariable String deploymentName, @PathVariable String metricStoreType, @RequestParam(required = false, defaultValue = DefaultControllerValues.validate) boolean validate, @RequestParam(required = false, defaultValue = DefaultControllerValues.severity) Severity severity, @RequestBody Object rawMetricStore) {
    MetricStore metricStore = objectMapper.convertValue(rawMetricStore, MetricStores.translateMetricStoreType(metricStoreType));
    UpdateRequestBuilder builder = new UpdateRequestBuilder();
    Path stagingPath = halconfigDirectoryStructure.getConfigPath(deploymentName);
    builder.setStage(() -> metricStore.stageLocalFiles(stagingPath));
    builder.setSeverity(severity);
    builder.setUpdate(() -> metricStoresService.setMetricStore(deploymentName, metricStore));
    builder.setValidate(ProblemSet::new);
    if (validate) {
        builder.setValidate(() -> metricStoresService.validateMetricStore(deploymentName, metricStoreType));
    }
    builder.setRevert(() -> halconfigParser.undoChanges());
    builder.setSave(() -> halconfigParser.saveConfig());
    builder.setClean(() -> halconfigParser.cleanLocalFiles(stagingPath));
    return DaemonTaskHandler.submitTask(builder::build, "Edit " + metricStoreType + " metric store");
}
Also used : MetricStore(com.netflix.spinnaker.halyard.config.model.v1.node.MetricStore) 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 9 with ProblemSet

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

the class MetricStoresController method setMetricStores.

@RequestMapping(value = "/", method = RequestMethod.PUT)
DaemonTask<Halconfig, Void> setMetricStores(@PathVariable String deploymentName, @RequestParam(required = false, defaultValue = DefaultControllerValues.validate) boolean validate, @RequestParam(required = false, defaultValue = DefaultControllerValues.severity) Severity severity, @RequestBody Object rawMetricStores) {
    MetricStores metricStores = objectMapper.convertValue(rawMetricStores, MetricStores.class);
    UpdateRequestBuilder builder = new UpdateRequestBuilder();
    Path configPath = halconfigDirectoryStructure.getConfigPath(deploymentName);
    builder.setStage(() -> metricStores.stageLocalFiles(configPath));
    builder.setSeverity(severity);
    builder.setUpdate(() -> metricStoresService.setMetricStores(deploymentName, metricStores));
    builder.setValidate(ProblemSet::new);
    if (validate) {
        builder.setValidate(() -> metricStoresService.validateMetricStores(deploymentName));
    }
    builder.setRevert(() -> halconfigParser.undoChanges());
    builder.setSave(() -> halconfigParser.saveConfig());
    builder.setClean(() -> halconfigParser.cleanLocalFiles(configPath));
    return DaemonTaskHandler.submitTask(builder::build, "Edit all metric stores");
}
Also used : Path(java.nio.file.Path) MetricStores(com.netflix.spinnaker.halyard.config.model.v1.node.MetricStores) 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 10 with ProblemSet

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

the class MetricStoresController method setMethodEnabled.

@RequestMapping(value = "/{metricStoreType:.+}/enabled/", method = RequestMethod.PUT)
DaemonTask<Halconfig, Void> setMethodEnabled(@PathVariable String deploymentName, @PathVariable String metricStoreType, @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(() -> metricStoresService.setMetricStoreEnabled(deploymentName, metricStoreType, enabled));
    builder.setSeverity(severity);
    builder.setValidate(ProblemSet::new);
    if (validate) {
        builder.setValidate(() -> metricStoresService.validateMetricStore(deploymentName, metricStoreType));
    }
    builder.setRevert(() -> halconfigParser.undoChanges());
    builder.setSave(() -> halconfigParser.saveConfig());
    return DaemonTaskHandler.submitTask(builder::build, "Edit " + metricStoreType + " metric store");
}
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)

Aggregations

ProblemSet (com.netflix.spinnaker.halyard.core.problem.v1.ProblemSet)54 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)52 UpdateRequestBuilder (com.netflix.spinnaker.halyard.core.DaemonResponse.UpdateRequestBuilder)50 Path (java.nio.file.Path)37 DaemonResponse (com.netflix.spinnaker.halyard.core.DaemonResponse)3 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 Problem (com.netflix.spinnaker.halyard.core.problem.v1.Problem)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