use of com.netflix.spinnaker.halyard.config.model.v1.node.Pubsubs 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());
}
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Pubsubs in project halyard by spinnaker.
the class EchoProfileFactory method setProfile.
@Override
protected void setProfile(Profile profile, DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints) {
super.setProfile(profile, deploymentConfiguration, endpoints);
List<String> files = new ArrayList<>();
profile.appendContents("global.spinnaker.timezone: " + deploymentConfiguration.getTimezone());
profile.appendContents("spinnaker.baseUrl: " + endpoints.getServices().getDeck().getBaseUrl());
Notifications notifications = deploymentConfiguration.getNotifications();
if (notifications != null) {
files.addAll(backupRequiredFiles(notifications, deploymentConfiguration.getName()));
profile.appendContents(yamlToString(notifications));
}
Pubsubs pubsubs = deploymentConfiguration.getPubsub();
if (pubsubs != null) {
files.addAll(backupRequiredFiles(pubsubs, deploymentConfiguration.getName()));
profile.appendContents(yamlToString(new PubsubWrapper(pubsubs)));
}
profile.appendContents(profile.getBaseContents()).setRequiredFiles(files);
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Pubsubs in project halyard by spinnaker.
the class PubsubService method setPubsub.
public void setPubsub(String deploymentName, Pubsub pubsub) {
DeploymentConfiguration deploymentConfiguration = deploymentService.getDeploymentConfiguration(deploymentName);
Pubsubs pubsubs = deploymentConfiguration.getPubsub();
switch(pubsub.pubsubType()) {
case GOOGLE:
pubsubs.setGoogle((GooglePubsub) pubsub);
break;
default:
throw new IllegalArgumentException("Unknown pubsub type " + pubsub.pubsubType());
}
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Pubsubs in project halyard by spinnaker.
the class PubsubService method getAllPubsubs.
public List<Pubsub> getAllPubsubs(String deploymentName) {
NodeFilter filter = new NodeFilter().setDeployment(deploymentName).withAnyPubsub();
List<Pubsub> matching = lookupService.getMatchingNodesOfType(filter, Pubsub.class);
if (matching.size() == 0) {
throw new ConfigNotFoundException(new ConfigProblemBuilder(Severity.FATAL, "No pubsubs could be found").build());
} else {
return matching;
}
}
Aggregations