Search in sources :

Example 1 with ConfigNotFoundException

use of com.netflix.spinnaker.halyard.config.error.v1.ConfigNotFoundException in project halyard by spinnaker.

the class ProviderService method getProvider.

public Provider getProvider(String deploymentName, String providerName) {
    NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setProvider(providerName);
    List<Provider> matching = lookupService.getMatchingNodesOfType(filter, Provider.class);
    switch(matching.size()) {
        case 0:
            throw new ConfigNotFoundException(new ConfigProblemBuilder(Severity.FATAL, "No provider with name \"" + providerName + "\" could be found").setRemediation("Create a new provider with name \"" + providerName + "\"").build());
        case 1:
            return matching.get(0);
        default:
            throw new IllegalConfigException(new ConfigProblemBuilder(Severity.FATAL, "More than one provider with name \"" + providerName + "\" found").setRemediation("Manually delete or rename duplicate providers with name \"" + providerName + "\" 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) IllegalConfigException(com.netflix.spinnaker.halyard.config.error.v1.IllegalConfigException) GoogleProvider(com.netflix.spinnaker.halyard.config.model.v1.providers.google.GoogleProvider) AzureProvider(com.netflix.spinnaker.halyard.config.model.v1.providers.azure.AzureProvider) AwsProvider(com.netflix.spinnaker.halyard.config.model.v1.providers.aws.AwsProvider) AppengineProvider(com.netflix.spinnaker.halyard.config.model.v1.providers.appengine.AppengineProvider) DockerRegistryProvider(com.netflix.spinnaker.halyard.config.model.v1.providers.dockerRegistry.DockerRegistryProvider) OracleBMCSProvider(com.netflix.spinnaker.halyard.config.model.v1.providers.oraclebmcs.OracleBMCSProvider) OpenstackProvider(com.netflix.spinnaker.halyard.config.model.v1.providers.openstack.OpenstackProvider) DCOSProvider(com.netflix.spinnaker.halyard.config.model.v1.providers.dcos.DCOSProvider) KubernetesProvider(com.netflix.spinnaker.halyard.config.model.v1.providers.kubernetes.KubernetesProvider)

Example 2 with ConfigNotFoundException

use of com.netflix.spinnaker.halyard.config.error.v1.ConfigNotFoundException in project halyard by spinnaker.

the class NotificationService method getNotification.

public Notification getNotification(String deploymentName, String notificationName) {
    NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setNotification(notificationName);
    List<Notification> matching = lookupService.getMatchingNodesOfType(filter, Notification.class);
    switch(matching.size()) {
        case 0:
            throw new ConfigNotFoundException(new ConfigProblemBuilder(Severity.FATAL, "No notification type with name \"" + notificationName + "\" could be found").build());
        case 1:
            return matching.get(0);
        default:
            throw new IllegalConfigException(new ConfigProblemBuilder(Severity.FATAL, "More than one notification type with name \"" + notificationName + "\" found").build());
    }
}
Also used : ConfigProblemBuilder(com.netflix.spinnaker.halyard.config.problem.v1.ConfigProblemBuilder) ConfigNotFoundException(com.netflix.spinnaker.halyard.config.error.v1.ConfigNotFoundException) Notification(com.netflix.spinnaker.halyard.config.model.v1.node.Notification) SlackNotification(com.netflix.spinnaker.halyard.config.model.v1.notifications.SlackNotification) IllegalConfigException(com.netflix.spinnaker.halyard.config.error.v1.IllegalConfigException) NodeFilter(com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter)

Example 3 with ConfigNotFoundException

use of com.netflix.spinnaker.halyard.config.error.v1.ConfigNotFoundException 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 4 with ConfigNotFoundException

use of com.netflix.spinnaker.halyard.config.error.v1.ConfigNotFoundException 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 5 with ConfigNotFoundException

use of com.netflix.spinnaker.halyard.config.error.v1.ConfigNotFoundException 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)

Aggregations

ConfigNotFoundException (com.netflix.spinnaker.halyard.config.error.v1.ConfigNotFoundException)19 ConfigProblemBuilder (com.netflix.spinnaker.halyard.config.problem.v1.ConfigProblemBuilder)18 NodeFilter (com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter)16 IllegalConfigException (com.netflix.spinnaker.halyard.config.error.v1.IllegalConfigException)8 DeploymentConfiguration (com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration)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 Account (com.netflix.spinnaker.halyard.config.model.v1.node.Account)2 ArtifactProvider (com.netflix.spinnaker.halyard.config.model.v1.node.ArtifactProvider)2 Ci (com.netflix.spinnaker.halyard.config.model.v1.node.Ci)2 Pubsub (com.netflix.spinnaker.halyard.config.model.v1.node.Pubsub)2 GooglePubsub (com.netflix.spinnaker.halyard.config.model.v1.pubsub.google.GooglePubsub)2 AbstractCanaryAccount (com.netflix.spinnaker.halyard.config.model.v1.canary.AbstractCanaryAccount)1 AbstractCanaryServiceIntegration (com.netflix.spinnaker.halyard.config.model.v1.canary.AbstractCanaryServiceIntegration)1 ArtifactAccount (com.netflix.spinnaker.halyard.config.model.v1.node.ArtifactAccount)1 BaseImage (com.netflix.spinnaker.halyard.config.model.v1.node.BaseImage)1 Cluster (com.netflix.spinnaker.halyard.config.model.v1.node.Cluster)1 Master (com.netflix.spinnaker.halyard.config.model.v1.node.Master)1 Notification (com.netflix.spinnaker.halyard.config.model.v1.node.Notification)1