Search in sources :

Example 6 with NodeFilter

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

the class PersistentStorageService method getPersistentStorage.

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

Example 7 with NodeFilter

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

the class PersistentStorageService method getPersistentStore.

public PersistentStore getPersistentStore(String deploymentName, String persistentStoreType) {
    NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setPersistentStore(persistentStoreType);
    List<PersistentStore> matching = lookupService.getMatchingNodesOfType(filter, PersistentStore.class);
    switch(matching.size()) {
        case 0:
            throw new ConfigNotFoundException(new ConfigProblemBuilder(Problem.Severity.FATAL, "No persistent store with name \"" + persistentStoreType + "\" could be found").setRemediation("Create a new persistent store with name \"" + persistentStoreType + "\"").build());
        case 1:
            return matching.get(0);
        default:
            throw new IllegalConfigException(new ConfigProblemBuilder(Problem.Severity.FATAL, "More than one persistent store with name \"" + persistentStoreType + "\" found").setRemediation("Manually delete or rename duplicate persistent stores with name \"" + persistentStoreType + "\" in your halconfig file").build());
    }
}
Also used : ConfigProblemBuilder(com.netflix.spinnaker.halyard.config.problem.v1.ConfigProblemBuilder) ConfigNotFoundException(com.netflix.spinnaker.halyard.config.error.v1.ConfigNotFoundException) OracleBMCSPersistentStore(com.netflix.spinnaker.halyard.config.model.v1.persistentStorage.OracleBMCSPersistentStore) PersistentStore(com.netflix.spinnaker.halyard.config.model.v1.node.PersistentStore) S3PersistentStore(com.netflix.spinnaker.halyard.config.model.v1.persistentStorage.S3PersistentStore) AzsPersistentStore(com.netflix.spinnaker.halyard.config.model.v1.persistentStorage.AzsPersistentStore) GcsPersistentStore(com.netflix.spinnaker.halyard.config.model.v1.persistentStorage.GcsPersistentStore) IllegalConfigException(com.netflix.spinnaker.halyard.config.error.v1.IllegalConfigException) NodeFilter(com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter)

Example 8 with NodeFilter

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

the class PubsubService method getPubsub.

public Pubsub getPubsub(String deploymentName, String pubsubName) {
    NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setPubsub(pubsubName);
    List<Pubsub> matching = lookupService.getMatchingNodesOfType(filter, Pubsub.class);
    switch(matching.size()) {
        case 0:
            throw new ConfigNotFoundException(new ConfigProblemBuilder(Severity.FATAL, "No pubsub with name \"" + pubsubName + "\" could be found").setRemediation("Create a new pubsub with name \"" + pubsubName + "\"").build());
        case 1:
            return matching.get(0);
        default:
            throw new IllegalConfigException(new ConfigProblemBuilder(Severity.FATAL, "More than one pubsub with name \"" + pubsubName + "\" found").setRemediation("Manually delete or rename duplicate pubsubs with name \"" + pubsubName + "\" in your halconfig file").build());
    }
}
Also used : Pubsub(com.netflix.spinnaker.halyard.config.model.v1.node.Pubsub) GooglePubsub(com.netflix.spinnaker.halyard.config.model.v1.pubsub.google.GooglePubsub) ConfigProblemBuilder(com.netflix.spinnaker.halyard.config.problem.v1.ConfigProblemBuilder) ConfigNotFoundException(com.netflix.spinnaker.halyard.config.error.v1.ConfigNotFoundException) IllegalConfigException(com.netflix.spinnaker.halyard.config.error.v1.IllegalConfigException) NodeFilter(com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter)

Example 9 with NodeFilter

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

the class SubscriptionService method getAllSubscriptions.

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

Example 10 with NodeFilter

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

the class ArtifactAccountService method getAllArtifactAccounts.

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

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