use of com.netflix.spinnaker.halyard.config.model.v1.node.Account in project halyard by spinnaker.
the class ListCanaryAccountsCommand method executeThis.
@Override
protected void executeThis() {
AbstractCanaryServiceIntegration serviceIntegration = CanaryUtils.getServiceIntegrationByName(null, getCurrentDeployment(), getServiceIntegration(), noValidate);
List<AbstractCanaryAccount> accounts = serviceIntegration.getAccounts();
if (accounts.isEmpty()) {
AnsiUi.success("No configured accounts for " + getServiceIntegration() + ".");
} else {
AnsiUi.success("Accounts for " + getServiceIntegration() + ":");
accounts.forEach(account -> AnsiUi.listItem(account.getName()));
}
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Account in project halyard by spinnaker.
the class AwsAddCanaryAccountCommand method buildAccount.
@Override
protected AbstractCanaryAccount buildAccount(Canary canary, String accountName) {
AwsCanaryAccount account = (AwsCanaryAccount) new AwsCanaryAccount().setName(accountName);
account.setBucket(bucket);
account.setRootFolder(isSet(rootFolder) ? rootFolder : account.getRootFolder());
AwsCanaryServiceIntegration awsCanaryServiceIntegration = (AwsCanaryServiceIntegration) CanaryUtils.getServiceIntegrationByClass(canary, AwsCanaryServiceIntegration.class);
if (awsCanaryServiceIntegration.isS3Enabled()) {
account.getSupportedTypes().add(AbstractCanaryServiceIntegration.SupportedTypes.CONFIGURATION_STORE);
account.getSupportedTypes().add(AbstractCanaryServiceIntegration.SupportedTypes.OBJECT_STORE);
}
return account;
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Account in project halyard by spinnaker.
the class AccountController method setAccount.
@RequestMapping(value = "/account/{accountName:.+}", method = RequestMethod.PUT)
DaemonTask<Halconfig, Void> setAccount(@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, @RequestBody Object rawAccount) {
Account account = objectMapper.convertValue(rawAccount, Providers.translateAccountType(providerName));
UpdateRequestBuilder builder = new UpdateRequestBuilder();
Path configPath = halconfigDirectoryStructure.getConfigPath(deploymentName);
builder.setStage(() -> account.stageLocalFiles(configPath));
builder.setUpdate(() -> accountService.setAccount(deploymentName, providerName, accountName, account));
builder.setSeverity(severity);
Supplier<ProblemSet> doValidate = ProblemSet::new;
if (validate) {
doValidate = () -> accountService.validateAccount(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, "Edit the " + accountName + " account");
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Account in project halyard by spinnaker.
the class AccountController method addAccount.
@RequestMapping(value = "/", method = RequestMethod.POST)
DaemonTask<Halconfig, Void> addAccount(@PathVariable String deploymentName, @PathVariable String providerName, @RequestParam(required = false, defaultValue = DefaultControllerValues.validate) boolean validate, @RequestParam(required = false, defaultValue = DefaultControllerValues.severity) Severity severity, @RequestBody Object rawAccount) {
Account account = objectMapper.convertValue(rawAccount, Providers.translateAccountType(providerName));
UpdateRequestBuilder builder = new UpdateRequestBuilder();
Path configPath = halconfigDirectoryStructure.getConfigPath(deploymentName);
builder.setStage(() -> account.stageLocalFiles(configPath));
builder.setSeverity(severity);
builder.setUpdate(() -> accountService.addAccount(deploymentName, providerName, account));
Supplier<ProblemSet> doValidate = ProblemSet::new;
if (validate) {
doValidate = () -> accountService.validateAccount(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() + " account");
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Account in project halyard by spinnaker.
the class OpenstackAddAccountCommand method buildAccount.
@Override
protected Account buildAccount(String accountName) {
OpenstackAccount account = (OpenstackAccount) new OpenstackAccount().setName(accountName);
OpenstackAccount.OpenstackLbaasOptions lbaas = new OpenstackAccount.OpenstackLbaasOptions();
if (isSet(lbaasPollInterval)) {
lbaas.setPollInterval(lbaasPollInterval);
}
if (isSet(lbaasPollTimeout)) {
lbaas.setPollTimeout(lbaasPollTimeout);
}
account.setAuthUrl(authUrl).setUsername(username).setPassword(password).setEnvironment(environment).setAccountType(accountType).setHeatTemplateLocation(heatTemplateLocation).setProjectName(projectName).setDomainName(domainName).setRegions(regions).setInsecure(insecure).setUserDataFile(userDataFile).setConsulConfig(consulConfig).setLbaas(lbaas);
return account;
}
Aggregations