use of com.netflix.spinnaker.halyard.core.problem.v1.ProblemSet in project halyard by spinnaker.
the class ArtifactAccountController method deleteArtifactAccount.
@RequestMapping(value = "/account/{accountName:.+}", method = RequestMethod.DELETE)
DaemonTask<Halconfig, Void> deleteArtifactAccount(@PathVariable String deploymentName, @PathVariable String providerName, @PathVariable String accountName, @RequestParam(required = false, defaultValue = DefaultControllerValues.validate) boolean validate, @RequestParam(required = false, defaultValue = DefaultControllerValues.severity) Severity severity) {
UpdateRequestBuilder builder = new UpdateRequestBuilder();
builder.setUpdate(() -> accountService.deleteArtifactAccount(deploymentName, providerName, accountName));
builder.setSeverity(severity);
Supplier<ProblemSet> doValidate = ProblemSet::new;
if (validate) {
doValidate = () -> accountService.validateAllArtifactAccounts(deploymentName, providerName);
}
builder.setValidate(doValidate);
builder.setRevert(() -> halconfigParser.undoChanges());
builder.setSave(() -> halconfigParser.saveConfig());
Path configPath = halconfigDirectoryStructure.getConfigPath(deploymentName);
builder.setClean(() -> halconfigParser.cleanLocalFiles(configPath));
return DaemonTaskHandler.submitTask(builder::build, "Delete the " + accountName + " artifact account");
}
use of com.netflix.spinnaker.halyard.core.problem.v1.ProblemSet in project halyard by spinnaker.
the class ArtifactAccountController method addArtifactAccount.
@RequestMapping(value = "/", method = RequestMethod.POST)
DaemonTask<Halconfig, Void> addArtifactAccount(@PathVariable String deploymentName, @PathVariable String providerName, @RequestParam(required = false, defaultValue = DefaultControllerValues.validate) boolean validate, @RequestParam(required = false, defaultValue = DefaultControllerValues.severity) Severity severity, @RequestBody Object rawArtifactAccount) {
ArtifactAccount account = objectMapper.convertValue(rawArtifactAccount, Artifacts.translateArtifactAccountType(providerName));
UpdateRequestBuilder builder = new UpdateRequestBuilder();
Path configPath = halconfigDirectoryStructure.getConfigPath(deploymentName);
builder.setStage(() -> account.stageLocalFiles(configPath));
builder.setSeverity(severity);
builder.setUpdate(() -> accountService.addArtifactAccount(deploymentName, providerName, account));
Supplier<ProblemSet> doValidate = ProblemSet::new;
if (validate) {
doValidate = () -> accountService.validateArtifactAccount(deploymentName, providerName, account.getName());
}
builder.setValidate(doValidate);
builder.setRevert(() -> halconfigParser.undoChanges());
builder.setSave(() -> halconfigParser.saveConfig());
builder.setClean(() -> halconfigParser.cleanLocalFiles(configPath));
return DaemonTaskHandler.submitTask(builder::build, "Add the " + account.getName() + " artifact account");
}
use of com.netflix.spinnaker.halyard.core.problem.v1.ProblemSet in project halyard by spinnaker.
the class CanaryController method setCanaryAccount.
@RequestMapping(value = "/{serviceIntegrationName:.+}/accounts/account/{accountName:.+}", method = RequestMethod.PUT)
DaemonTask<Halconfig, Void> setCanaryAccount(@PathVariable String deploymentName, @PathVariable String serviceIntegrationName, @PathVariable String accountName, @RequestParam(required = false, defaultValue = DefaultControllerValues.validate) boolean validate, @RequestParam(required = false, defaultValue = DefaultControllerValues.severity) Severity severity, @RequestBody Object rawCanaryAccount) {
AbstractCanaryAccount canaryAccount = objectMapper.convertValue(rawCanaryAccount, Canary.translateCanaryAccountType(serviceIntegrationName));
UpdateRequestBuilder builder = new UpdateRequestBuilder();
Path configPath = halconfigDirectoryStructure.getConfigPath(deploymentName);
builder.setStage(() -> canaryAccount.stageLocalFiles(configPath));
builder.setUpdate(() -> canaryAccountService.setAccount(deploymentName, serviceIntegrationName, accountName, canaryAccount));
builder.setSeverity(severity);
Supplier<ProblemSet> doValidate = ProblemSet::new;
if (validate) {
doValidate = () -> canaryService.validateCanary(deploymentName);
}
builder.setValidate(doValidate);
builder.setRevert(() -> halconfigParser.undoChanges());
builder.setSave(() -> halconfigParser.saveConfig());
builder.setClean(() -> halconfigParser.cleanLocalFiles(configPath));
return DaemonTaskHandler.submitTask(builder::build, "Edit the " + accountName + " canary account");
}
use of com.netflix.spinnaker.halyard.core.problem.v1.ProblemSet in project halyard by spinnaker.
the class CanaryController method addCanaryAccount.
@RequestMapping(value = "/{serviceIntegrationName:.+}/accounts/", method = RequestMethod.POST)
DaemonTask<Halconfig, Void> addCanaryAccount(@PathVariable String deploymentName, @PathVariable String serviceIntegrationName, @RequestParam(required = false, defaultValue = DefaultControllerValues.validate) boolean validate, @RequestParam(required = false, defaultValue = DefaultControllerValues.severity) Severity severity, @RequestBody Object rawCanaryAccount) {
AbstractCanaryAccount canaryAccount = objectMapper.convertValue(rawCanaryAccount, Canary.translateCanaryAccountType(serviceIntegrationName));
UpdateRequestBuilder builder = new UpdateRequestBuilder();
Path configPath = halconfigDirectoryStructure.getConfigPath(deploymentName);
builder.setStage(() -> canaryAccount.stageLocalFiles(configPath));
builder.setSeverity(severity);
builder.setUpdate(() -> canaryAccountService.addAccount(deploymentName, serviceIntegrationName, canaryAccount));
Supplier<ProblemSet> doValidate = ProblemSet::new;
if (validate) {
doValidate = () -> canaryService.validateCanary(deploymentName);
}
builder.setValidate(doValidate);
builder.setRevert(() -> halconfigParser.undoChanges());
builder.setSave(() -> halconfigParser.saveConfig());
builder.setClean(() -> halconfigParser.cleanLocalFiles(configPath));
return DaemonTaskHandler.submitTask(builder::build, "Add the " + canaryAccount.getName() + " canary account to " + serviceIntegrationName + " service integration");
}
use of com.netflix.spinnaker.halyard.core.problem.v1.ProblemSet in project halyard by spinnaker.
the class CanaryController method setCanary.
@RequestMapping(value = "/", method = RequestMethod.PUT)
DaemonTask<Halconfig, Void> setCanary(@PathVariable String deploymentName, @RequestParam(required = false, defaultValue = DefaultControllerValues.validate) boolean validate, @RequestParam(required = false, defaultValue = DefaultControllerValues.severity) Severity severity, @RequestBody Object rawCanary) {
Canary canary = objectMapper.convertValue(rawCanary, Canary.class);
UpdateRequestBuilder builder = new UpdateRequestBuilder();
Path configPath = halconfigDirectoryStructure.getConfigPath(deploymentName);
builder.setStage(() -> canary.stageLocalFiles(configPath));
builder.setSeverity(severity);
builder.setUpdate(() -> canaryService.setCanary(deploymentName, canary));
builder.setValidate(ProblemSet::new);
if (validate) {
builder.setValidate(() -> canaryService.validateCanary(deploymentName));
}
builder.setRevert(() -> halconfigParser.undoChanges());
builder.setSave(() -> halconfigParser.saveConfig());
builder.setClean(() -> halconfigParser.cleanLocalFiles(configPath));
return DaemonTaskHandler.submitTask(builder::build, "Edit canary analysis settings");
}
Aggregations