use of com.netflix.spinnaker.halyard.config.problem.v1.ConfigProblemBuilder 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.problem.v1.ConfigProblemBuilder in project halyard by spinnaker.
the class BakeryService method deleteBaseImage.
public void deleteBaseImage(String deploymentName, String bakeryDefaultsName, String baseImageId) {
BakeryDefaults bakeryDefaults = getBakeryDefaults(deploymentName, bakeryDefaultsName);
boolean removed = bakeryDefaults.getBaseImages().removeIf(baseImage -> ((BaseImage) baseImage).getBaseImage().getId().equals(baseImageId));
if (!removed) {
throw new HalException(new ConfigProblemBuilder(Severity.FATAL, "BaseImage \"" + baseImageId + "\" wasn't found").build());
}
}
use of com.netflix.spinnaker.halyard.config.problem.v1.ConfigProblemBuilder 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.problem.v1.ConfigProblemBuilder 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.problem.v1.ConfigProblemBuilder 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