Search in sources :

Example 1 with HasClustersProvider

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

the class ProviderService method getHasClustersProvider.

public HasClustersProvider getHasClustersProvider(String deploymentName, String providerName) {
    NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setProvider(providerName);
    Provider provider = getProvider(deploymentName, providerName);
    if (provider instanceof HasClustersProvider) {
        return (HasClustersProvider) provider;
    } else {
        throw new IllegalConfigException(new ConfigProblemBuilder(Severity.FATAL, "Provider \"" + providerName + "\" does not support configuring clusters via Halyard.").build());
    }
}
Also used : ConfigProblemBuilder(com.netflix.spinnaker.halyard.config.problem.v1.ConfigProblemBuilder) 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 HasClustersProvider

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

the class ClusterService method deleteCluster.

public void deleteCluster(String deploymentName, String providerName, String clusterName) {
    final HasClustersProvider clustersProvider = providerService.getHasClustersProvider(deploymentName, providerName);
    final List<Cluster> clusters = (List<Cluster>) clustersProvider.getClusters();
    boolean removed = clusters.removeIf(cluster -> cluster.getName().equals(clusterName));
    if (!removed) {
        throw new HalException(Problem.Severity.FATAL, "Cluster \"" + clusterName + "\" wasn't found");
    }
}
Also used : HasClustersProvider(com.netflix.spinnaker.halyard.config.model.v1.node.HasClustersProvider) HalException(com.netflix.spinnaker.halyard.core.error.v1.HalException) Cluster(com.netflix.spinnaker.halyard.config.model.v1.node.Cluster) List(java.util.List)

Example 3 with HasClustersProvider

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

the class ClusterService method addCluster.

public void addCluster(String deploymentName, String providerName, Cluster newCluster) {
    final HasClustersProvider clustersProvider = providerService.getHasClustersProvider(deploymentName, providerName);
    clustersProvider.getClusters().add(newCluster);
}
Also used : HasClustersProvider(com.netflix.spinnaker.halyard.config.model.v1.node.HasClustersProvider)

Aggregations

HasClustersProvider (com.netflix.spinnaker.halyard.config.model.v1.node.HasClustersProvider)2 IllegalConfigException (com.netflix.spinnaker.halyard.config.error.v1.IllegalConfigException)1 Cluster (com.netflix.spinnaker.halyard.config.model.v1.node.Cluster)1 AppengineProvider (com.netflix.spinnaker.halyard.config.model.v1.providers.appengine.AppengineProvider)1 AwsProvider (com.netflix.spinnaker.halyard.config.model.v1.providers.aws.AwsProvider)1 AzureProvider (com.netflix.spinnaker.halyard.config.model.v1.providers.azure.AzureProvider)1 DCOSProvider (com.netflix.spinnaker.halyard.config.model.v1.providers.dcos.DCOSProvider)1 DockerRegistryProvider (com.netflix.spinnaker.halyard.config.model.v1.providers.dockerRegistry.DockerRegistryProvider)1 GoogleProvider (com.netflix.spinnaker.halyard.config.model.v1.providers.google.GoogleProvider)1 KubernetesProvider (com.netflix.spinnaker.halyard.config.model.v1.providers.kubernetes.KubernetesProvider)1 OpenstackProvider (com.netflix.spinnaker.halyard.config.model.v1.providers.openstack.OpenstackProvider)1 OracleBMCSProvider (com.netflix.spinnaker.halyard.config.model.v1.providers.oraclebmcs.OracleBMCSProvider)1 ConfigProblemBuilder (com.netflix.spinnaker.halyard.config.problem.v1.ConfigProblemBuilder)1 HalException (com.netflix.spinnaker.halyard.core.error.v1.HalException)1 List (java.util.List)1