public void setCurrentDeployment(String deploymentName) { Halconfig config = getConfig(); boolean found = config.getDeploymentConfigurations().stream() .anyMatch(c -> c.getName().equals(deploymentName)); if (!found) { config.getDeploymentConfigurations().add(new DeploymentConfiguration().setName(deploymentName)); } config.setCurrentDeployment(deploymentName); } }
@Override public void validate(ConfigProblemSetBuilder p, EcsAccount n) { p.addProblem(Severity.WARNING, "This only validates that a corresponding AWS account has been " + "created for your ECS account."); String ecsAwsAccount = n.getAwsAccount(); List<Account> accounts = accountService.getAllAccounts(configService.getCurrentDeployment(), "aws"); Optional<Account> account = accounts.stream().filter(act -> act.getName().equals(ecsAwsAccount)).findAny(); if (!account.isPresent()) { p.addProblem(Severity.ERROR, "No AWS Account found matching " + ecsAwsAccount); } }
@RequestMapping(value = "/currentDeployment", method = RequestMethod.PUT) DaemonTask<Halconfig, Void> setDeployment(@RequestBody StringBodyRequest name) { DaemonResponse.UpdateRequestBuilder builder = new DaemonResponse.UpdateRequestBuilder(); builder.setUpdate(() -> configService.setCurrentDeployment(name.getValue())); builder.setRevert(halconfigParser::undoChanges); builder.setSave(halconfigParser::saveConfig); builder.setValidate(ProblemSet::new); return DaemonTaskHandler.submitTask(builder::build, "Set current deployment"); } }
public void setCurrentDeployment(String deploymentName) { Halconfig config = getConfig(); boolean found = config.getDeploymentConfigurations().stream() .anyMatch(c -> c.getName().equals(deploymentName)); if (!found) { config.getDeploymentConfigurations().add(new DeploymentConfiguration().setName(deploymentName)); } config.setCurrentDeployment(deploymentName); } }
@Override public void validate(ConfigProblemSetBuilder p, EcsAccount n) { p.addProblem(Severity.WARNING, "This only validates that a corresponding AWS account has been " + "created for your ECS account."); String ecsAwsAccount = n.getAwsAccount(); List<Account> accounts = accountService.getAllAccounts(configService.getCurrentDeployment(), "aws"); Optional<Account> account = accounts.stream().filter(act -> act.getName().equals(ecsAwsAccount)).findAny(); if (!account.isPresent()) { p.addProblem(Severity.ERROR, "No AWS Account found matching " + ecsAwsAccount); } }
public String getCurrentDeployment() { String result = getConfig().getCurrentDeployment(); if (result == null || result.isEmpty()) { throw new IllegalConfigException( new ConfigProblemBuilder(Severity.FATAL, "No deployment has been set").build() ); } return result; }
public String getCurrentDeployment() { String result = getConfig().getCurrentDeployment(); if (result == null || result.isEmpty()) { throw new IllegalConfigException( new ConfigProblemBuilder(Severity.FATAL, "No deployment has been set").build() ); } return result; }