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());
}
}
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");
}
}
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);
}
Aggregations