public <T extends Node> FieldOptions options(NodeFilter filter, Class<T> nodeClass, String field) { ConfigProblemSetBuilder problemSetBuilder = new ConfigProblemSetBuilder(applicationContext); List<T> nodes = lookupService.getMatchingNodesOfType(filter, nodeClass); List<String> options = nodes.stream().map(n -> { problemSetBuilder.setNode(n); return n.fieldOptions(problemSetBuilder, field); }).reduce(new ArrayList<>(), (a, b) -> { a.addAll(b); return a; }); return new FieldOptions().setOptions(options).setProblemSet(problemSetBuilder.build()); }
public List<DeploymentConfiguration> getAllDeploymentConfigurations() { NodeFilter filter = new NodeFilter().withAnyDeployment(); List<DeploymentConfiguration> matching = lookupService.getMatchingNodesOfType(filter, DeploymentConfiguration.class); if (matching.size() == 0) { throw new ConfigNotFoundException( new ConfigProblemBuilder(Severity.FATAL, "No deployments could be found in your currently loaded halconfig") .build()); } else { return matching; } }
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; } }
public List<HaService> getAllHaServices(String deploymentName) { NodeFilter filter = new NodeFilter().setDeployment(deploymentName).withAnyHaService(); List<HaService> matching = lookupService.getMatchingNodesOfType(filter, HaService.class); if (matching.size() == 0) { throw new ConfigNotFoundException( new ConfigProblemBuilder(Severity.FATAL, "No high availability services could be found") .build()); } else { return matching; } }
public List<HaService> getAllHaServices(String deploymentName) { NodeFilter filter = new NodeFilter().setDeployment(deploymentName).withAnyHaService(); List<HaService> matching = lookupService.getMatchingNodesOfType(filter, HaService.class); if (matching.size() == 0) { throw new ConfigNotFoundException( new ConfigProblemBuilder(Severity.FATAL, "No high availability services could be found") .build()); } else { return matching; } }
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; } }
public List<Provider> getAllProviders(String deploymentName) { NodeFilter filter = new NodeFilter().setDeployment(deploymentName).withAnyProvider(); List<Provider> matching = lookupService.getMatchingNodesOfType(filter, Provider.class); if (matching.size() == 0) { throw new ConfigNotFoundException( new ConfigProblemBuilder(Severity.FATAL, "No providers could be found") .build()); } else { return matching; } }
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; } }
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; } }
public List<Subscription> getAllSubscriptions(String deploymentName, String pubsubName) { NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setPubsub(pubsubName).withAnySubscription(); List<Subscription> matchingSubscriptions = lookupService.getMatchingNodesOfType(filter, Subscription.class); if (matchingSubscriptions.size() == 0) { throw new ConfigNotFoundException( new ConfigProblemBuilder(Severity.FATAL, "No subscriptions could be found").build()); } else { return matchingSubscriptions; } }
public List<ArtifactAccount> getAllArtifactAccounts(String deploymentName, String providerName) { NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setArtifactProvider(providerName).withAnyArtifactAccount(); List<ArtifactAccount> matchingArtifactAccounts = lookupService.getMatchingNodesOfType(filter, ArtifactAccount.class); if (matchingArtifactAccounts.size() == 0) { throw new ConfigNotFoundException( new ConfigProblemBuilder(Severity.FATAL, "No accounts could be found").build()); } else { return matchingArtifactAccounts; } }
public List<Subscription> getAllSubscriptions(String deploymentName, String pubsubName) { NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setPubsub(pubsubName).withAnySubscription(); List<Subscription> matchingSubscriptions = lookupService.getMatchingNodesOfType(filter, Subscription.class); if (matchingSubscriptions.size() == 0) { throw new ConfigNotFoundException( new ConfigProblemBuilder(Severity.FATAL, "No subscriptions could be found").build()); } else { return matchingSubscriptions; } }
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; } }
public List<Master> getAllMasters(String deploymentName, String ciName) { NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setCi(ciName).withAnyMaster(); List<Master> matchingMasters = lookupService.getMatchingNodesOfType(filter, Master.class); if (matchingMasters.size() == 0) { throw new ConfigNotFoundException( new ConfigProblemBuilder(Severity.FATAL, "No masters could be found").build()); } else { return matchingMasters; } }
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; } }
public List<Master> getAllMasters(String deploymentName, String ciName) { NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setCi(ciName).withAnyMaster(); List<Master> matchingMasters = lookupService.getMatchingNodesOfType(filter, Master.class); if (matchingMasters.size() == 0) { throw new ConfigNotFoundException( new ConfigProblemBuilder(Severity.FATAL, "No masters could be found").build()); } else { return matchingMasters; } }
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; } }
public List<ArtifactAccount> getAllArtifactAccounts(String deploymentName, String providerName) { NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setArtifactProvider(providerName).withAnyArtifactAccount(); List<ArtifactAccount> matchingArtifactAccounts = lookupService.getMatchingNodesOfType(filter, ArtifactAccount.class); if (matchingArtifactAccounts.size() == 0) { throw new ConfigNotFoundException( new ConfigProblemBuilder(Severity.FATAL, "No accounts could be found").build()); } else { return matchingArtifactAccounts; } }
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; } }
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; } }