Search in sources :

Example 31 with NodeFilter

use of com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter in project halyard by spinnaker.

the class DeploymentEnvironmentService method getDeploymentEnvironment.

public DeploymentEnvironment getDeploymentEnvironment(String deploymentName) {
    NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setDeploymentEnvironment();
    List<DeploymentEnvironment> matching = lookupService.getMatchingNodesOfType(filter, DeploymentEnvironment.class);
    switch(matching.size()) {
        case 0:
            DeploymentEnvironment deploymentEnvironment = new DeploymentEnvironment();
            setDeploymentEnvironment(deploymentName, deploymentEnvironment);
            return deploymentEnvironment;
        case 1:
            return matching.get(0);
        default:
            throw new RuntimeException("It shouldn't be possible to have multiple deploymentEnvironment nodes. This is a bug.");
    }
}
Also used : DeploymentEnvironment(com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentEnvironment) NodeFilter(com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter)

Example 32 with NodeFilter

use of com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter in project halyard by spinnaker.

the class FeaturesService method getFeatures.

public Features getFeatures(String deploymentName) {
    NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setFeatures();
    List<Features> matching = lookupService.getMatchingNodesOfType(filter, Features.class);
    switch(matching.size()) {
        case 0:
            Features features = new Features();
            setFeatures(deploymentName, features);
            return features;
        case 1:
            return matching.get(0);
        default:
            throw new RuntimeException("It shouldn't be possible to have multiple features nodes. This is a bug.");
    }
}
Also used : Features(com.netflix.spinnaker.halyard.config.model.v1.node.Features) 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