use of com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter in project halyard by spinnaker.
the class BakeryService method getAllBaseImages.
public List<BaseImage> getAllBaseImages(String deploymentName, String providerName) {
NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setProvider(providerName).setBakeryDefaults().withAnyBaseImage();
List<BaseImage> matchingBaseImages = lookupService.getMatchingNodesOfType(filter, BaseImage.class);
if (matchingBaseImages.size() == 0) {
throw new ConfigNotFoundException(new ConfigProblemBuilder(Severity.FATAL, "No base images could be found").build());
} else {
return matchingBaseImages;
}
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter in project halyard by spinnaker.
the class BakeryService method getBakeryDefaults.
public BakeryDefaults getBakeryDefaults(String deploymentName, String providerName) {
NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setProvider(providerName).setBakeryDefaults();
List<BakeryDefaults> matching = lookupService.getMatchingNodesOfType(filter, BakeryDefaults.class);
switch(matching.size()) {
case 0:
HasImageProvider provider = providerService.getHasImageProvider(deploymentName, providerName);
BakeryDefaults bakeryDefaults = provider.emptyBakeryDefaults();
setBakeryDefaults(deploymentName, providerName, bakeryDefaults);
return bakeryDefaults;
case 1:
return matching.get(0);
default:
throw new RuntimeException("It shouldn't be possible to have multiple bakeryDefaults nodes. This is a bug.");
}
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter in project halyard by spinnaker.
the class ClusterService method getAllClusters.
public List<Cluster> getAllClusters(String deploymentName, String providerName) {
NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setProvider(providerName).withAnyCluster();
List<Cluster> matchingClusters = lookupService.getMatchingNodesOfType(filter, Cluster.class);
if (matchingClusters.size() == 0) {
throw new ConfigNotFoundException(new ConfigProblemBuilder(Problem.Severity.FATAL, "No clusters could be found").build());
} else {
return matchingClusters;
}
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter in project halyard by spinnaker.
the class AccountService method getAllAccounts.
public List<Account> getAllAccounts(String deploymentName, String providerName) {
NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setProvider(providerName).withAnyAccount();
List<Account> matchingAccounts = lookupService.getMatchingNodesOfType(filter, Account.class);
if (matchingAccounts.size() == 0) {
throw new ConfigNotFoundException(new ConfigProblemBuilder(Severity.FATAL, "No accounts could be found").build());
} else {
return matchingAccounts;
}
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter in project halyard by spinnaker.
the class ArtifactProviderService method getAllArtifactProviders.
public List<ArtifactProvider> getAllArtifactProviders(String deploymentName) {
NodeFilter filter = new NodeFilter().setDeployment(deploymentName).withAnyArtifactProvider();
List<ArtifactProvider> matching = lookupService.getMatchingNodesOfType(filter, ArtifactProvider.class);
if (matching.size() == 0) {
throw new ConfigNotFoundException(new ConfigProblemBuilder(Severity.FATAL, "No providers could be found").build());
} else {
return matching;
}
}
Aggregations