Search in sources :

Example 11 with NodeFilter

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;
    }
}
Also used : ConfigProblemBuilder(com.netflix.spinnaker.halyard.config.problem.v1.ConfigProblemBuilder) ConfigNotFoundException(com.netflix.spinnaker.halyard.config.error.v1.ConfigNotFoundException) BaseImage(com.netflix.spinnaker.halyard.config.model.v1.node.BaseImage) NodeFilter(com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter)

Example 12 with NodeFilter

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.");
    }
}
Also used : BakeryDefaults(com.netflix.spinnaker.halyard.config.model.v1.node.BakeryDefaults) NodeFilter(com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter) HasImageProvider(com.netflix.spinnaker.halyard.config.model.v1.node.HasImageProvider)

Example 13 with NodeFilter

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;
    }
}
Also used : ConfigProblemBuilder(com.netflix.spinnaker.halyard.config.problem.v1.ConfigProblemBuilder) ConfigNotFoundException(com.netflix.spinnaker.halyard.config.error.v1.ConfigNotFoundException) Cluster(com.netflix.spinnaker.halyard.config.model.v1.node.Cluster) NodeFilter(com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter)

Example 14 with NodeFilter

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;
    }
}
Also used : Account(com.netflix.spinnaker.halyard.config.model.v1.node.Account) ConfigProblemBuilder(com.netflix.spinnaker.halyard.config.problem.v1.ConfigProblemBuilder) ConfigNotFoundException(com.netflix.spinnaker.halyard.config.error.v1.ConfigNotFoundException) NodeFilter(com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter)

Example 15 with NodeFilter

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;
    }
}
Also used : GitHubArtifactProvider(com.netflix.spinnaker.halyard.config.model.v1.artifacts.github.GitHubArtifactProvider) ArtifactProvider(com.netflix.spinnaker.halyard.config.model.v1.node.ArtifactProvider) HttpArtifactProvider(com.netflix.spinnaker.halyard.config.model.v1.artifacts.http.HttpArtifactProvider) GcsArtifactProvider(com.netflix.spinnaker.halyard.config.model.v1.artifacts.gcs.GcsArtifactProvider) ConfigProblemBuilder(com.netflix.spinnaker.halyard.config.problem.v1.ConfigProblemBuilder) ConfigNotFoundException(com.netflix.spinnaker.halyard.config.error.v1.ConfigNotFoundException) NodeFilter(com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter)

Aggregations

NodeFilter (com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter)26 ConfigProblemBuilder (com.netflix.spinnaker.halyard.config.problem.v1.ConfigProblemBuilder)20 ConfigNotFoundException (com.netflix.spinnaker.halyard.config.error.v1.ConfigNotFoundException)17 IllegalConfigException (com.netflix.spinnaker.halyard.config.error.v1.IllegalConfigException)9 Node (com.netflix.spinnaker.halyard.config.model.v1.node.Node)3 NodeIterator (com.netflix.spinnaker.halyard.config.model.v1.node.NodeIterator)3 PersistentStorage (com.netflix.spinnaker.halyard.config.model.v1.node.PersistentStorage)3 AppengineProvider (com.netflix.spinnaker.halyard.config.model.v1.providers.appengine.AppengineProvider)3 AwsProvider (com.netflix.spinnaker.halyard.config.model.v1.providers.aws.AwsProvider)3 AzureProvider (com.netflix.spinnaker.halyard.config.model.v1.providers.azure.AzureProvider)3 DCOSProvider (com.netflix.spinnaker.halyard.config.model.v1.providers.dcos.DCOSProvider)3 DockerRegistryProvider (com.netflix.spinnaker.halyard.config.model.v1.providers.dockerRegistry.DockerRegistryProvider)3 GoogleProvider (com.netflix.spinnaker.halyard.config.model.v1.providers.google.GoogleProvider)3 KubernetesProvider (com.netflix.spinnaker.halyard.config.model.v1.providers.kubernetes.KubernetesProvider)3 OpenstackProvider (com.netflix.spinnaker.halyard.config.model.v1.providers.openstack.OpenstackProvider)3 OracleBMCSProvider (com.netflix.spinnaker.halyard.config.model.v1.providers.oraclebmcs.OracleBMCSProvider)3 GcsArtifactProvider (com.netflix.spinnaker.halyard.config.model.v1.artifacts.gcs.GcsArtifactProvider)2 GitHubArtifactProvider (com.netflix.spinnaker.halyard.config.model.v1.artifacts.github.GitHubArtifactProvider)2 HttpArtifactProvider (com.netflix.spinnaker.halyard.config.model.v1.artifacts.http.HttpArtifactProvider)2 ArtifactProvider (com.netflix.spinnaker.halyard.config.model.v1.node.ArtifactProvider)2