use of com.netflix.spinnaker.halyard.config.model.v1.node.Ci in project halyard by spinnaker.
the class CiService method getAllCis.
public List<Ci> getAllCis(String deploymentName) {
NodeFilter filter = new NodeFilter().setDeployment(deploymentName).withAnyCi();
List<Ci> matching = lookupService.getMatchingNodesOfType(filter, Ci.class);
if (matching.size() == 0) {
throw new ConfigNotFoundException(new ConfigProblemBuilder(Severity.FATAL, "No cis could be found").build());
} else {
return matching;
}
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Ci in project halyard by spinnaker.
the class CiService method getCi.
public Ci getCi(String deploymentName, String ciName) {
NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setCi(ciName);
List<Ci> matching = lookupService.getMatchingNodesOfType(filter, Ci.class);
switch(matching.size()) {
case 0:
throw new ConfigNotFoundException(new ConfigProblemBuilder(Severity.FATAL, "No Continuous Integration service with name \"" + ciName + "\" could be found").build());
case 1:
return matching.get(0);
default:
throw new IllegalConfigException(new ConfigProblemBuilder(Severity.FATAL, "More than one CI with name \"" + ciName + "\" found").build());
}
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Ci in project halyard by spinnaker.
the class MasterService method deleteMaster.
public void deleteMaster(String deploymentName, String ciName, String masterName) {
Ci ci = ciService.getCi(deploymentName, ciName);
boolean removed = ci.getMasters().removeIf(master -> ((Master) master).getName().equals(masterName));
if (!removed) {
throw new HalException(new ConfigProblemBuilder(Severity.FATAL, "Master \"" + masterName + "\" wasn't found").build());
}
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Ci in project halyard by spinnaker.
the class MasterService method addMaster.
public void addMaster(String deploymentName, String ciName, Master newMaster) {
Ci ci = ciService.getCi(deploymentName, ciName);
ci.getMasters().add(newMaster);
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Ci in project halyard by spinnaker.
the class AbstractListMastersCommand method executeThis.
@Override
protected void executeThis() {
Ci ci = getCi();
List<Master> masters = ci.getMasters();
if (masters.isEmpty()) {
AnsiUi.success("No configured masters for " + getCiName() + ".");
} else {
AnsiUi.success("Masters for " + getCiName() + ":");
masters.forEach(master -> AnsiUi.listItem(master.getName()));
}
}
Aggregations