use of com.netflix.spinnaker.halyard.config.model.v1.node.Halconfig in project halyard by spinnaker.
the class AccountController method newAccountOptions.
@RequestMapping(value = "/options", method = RequestMethod.POST)
DaemonTask<Halconfig, List<String>> newAccountOptions(@PathVariable String deploymentName, @PathVariable String providerName, @RequestParam(required = false, defaultValue = DefaultControllerValues.severity) Severity severity, @RequestBody DaemonOptions rawAccountOptions) {
String fieldName = rawAccountOptions.getField();
Account account = objectMapper.convertValue(rawAccountOptions.getResource(), Providers.translateAccountType(providerName));
DaemonResponse.UpdateOptionsRequestBuilder builder = new DaemonResponse.UpdateOptionsRequestBuilder();
String accountName = account.getName();
builder.setUpdate(() -> accountService.addAccount(deploymentName, providerName, account));
builder.setFieldOptionsResponse(() -> accountService.getAccountOptions(deploymentName, providerName, accountName, fieldName));
builder.setSeverity(severity);
return DaemonTaskHandler.submitTask(builder::build, "Get " + fieldName + " options");
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Halconfig in project halyard by spinnaker.
the class ProviderService method getProvider.
public Provider getProvider(String deploymentName, String providerName) {
NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setProvider(providerName);
List<Provider> matching = lookupService.getMatchingNodesOfType(filter, Provider.class);
switch(matching.size()) {
case 0:
throw new ConfigNotFoundException(new ConfigProblemBuilder(Severity.FATAL, "No provider with name \"" + providerName + "\" could be found").setRemediation("Create a new provider with name \"" + providerName + "\"").build());
case 1:
return matching.get(0);
default:
throw new IllegalConfigException(new ConfigProblemBuilder(Severity.FATAL, "More than one provider with name \"" + providerName + "\" found").setRemediation("Manually delete or rename duplicate providers with name \"" + providerName + "\" in your halconfig file").build());
}
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Halconfig in project halyard by spinnaker.
the class ValidateService method validateMatchingFilter.
ProblemSet validateMatchingFilter(NodeFilter filter) {
DaemonTaskHandler.newStage("Running validation");
Halconfig halconfig = parser.getHalconfig();
ConfigProblemSetBuilder psBuilder = new ConfigProblemSetBuilder(applicationContext);
recursiveValidate(psBuilder, halconfig, filter);
return psBuilder.build();
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Halconfig in project halyard by spinnaker.
the class PersistentStorageService method getPersistentStore.
public PersistentStore getPersistentStore(String deploymentName, String persistentStoreType) {
NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setPersistentStore(persistentStoreType);
List<PersistentStore> matching = lookupService.getMatchingNodesOfType(filter, PersistentStore.class);
switch(matching.size()) {
case 0:
throw new ConfigNotFoundException(new ConfigProblemBuilder(Problem.Severity.FATAL, "No persistent store with name \"" + persistentStoreType + "\" could be found").setRemediation("Create a new persistent store with name \"" + persistentStoreType + "\"").build());
case 1:
return matching.get(0);
default:
throw new IllegalConfigException(new ConfigProblemBuilder(Problem.Severity.FATAL, "More than one persistent store with name \"" + persistentStoreType + "\" found").setRemediation("Manually delete or rename duplicate persistent stores with name \"" + persistentStoreType + "\" in your halconfig file").build());
}
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Halconfig in project halyard by spinnaker.
the class PubsubService method getPubsub.
public Pubsub getPubsub(String deploymentName, String pubsubName) {
NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setPubsub(pubsubName);
List<Pubsub> matching = lookupService.getMatchingNodesOfType(filter, Pubsub.class);
switch(matching.size()) {
case 0:
throw new ConfigNotFoundException(new ConfigProblemBuilder(Severity.FATAL, "No pubsub with name \"" + pubsubName + "\" could be found").setRemediation("Create a new pubsub with name \"" + pubsubName + "\"").build());
case 1:
return matching.get(0);
default:
throw new IllegalConfigException(new ConfigProblemBuilder(Severity.FATAL, "More than one pubsub with name \"" + pubsubName + "\" found").setRemediation("Manually delete or rename duplicate pubsubs with name \"" + pubsubName + "\" in your halconfig file").build());
}
}
Aggregations