use of com.netflix.spinnaker.halyard.config.model.v1.node.Provider in project halyard by spinnaker.
the class AccountService method deleteAccount.
public void deleteAccount(String deploymentName, String providerName, String accountName) {
Provider provider = providerService.getProvider(deploymentName, providerName);
boolean removed = provider.getAccounts().removeIf(account -> ((Account) account).getName().equals(accountName));
if (!removed) {
throw new HalException(new ConfigProblemBuilder(Severity.FATAL, "Account \"" + accountName + "\" wasn't found").build());
}
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Provider in project halyard by spinnaker.
the class ArtifactProviderService method setArtifactProvider.
public void setArtifactProvider(String deploymentName, ArtifactProvider provider) {
DeploymentConfiguration deploymentConfiguration = deploymentService.getDeploymentConfiguration(deploymentName);
Artifacts artifacts = deploymentConfiguration.getArtifacts();
switch(provider.providerType()) {
case GCS:
artifacts.setGcs((GcsArtifactProvider) provider);
break;
case GITHUB:
artifacts.setGithub((GitHubArtifactProvider) provider);
break;
case HTTP:
artifacts.setHttp((HttpArtifactProvider) provider);
break;
default:
throw new IllegalArgumentException("Unknown provider type " + provider.providerType());
}
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Provider in project halyard by spinnaker.
the class ArtifactProviderService method getArtifactProvider.
public ArtifactProvider getArtifactProvider(String deploymentName, String providerName) {
NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setArtifactProvider(providerName);
List<ArtifactProvider> matching = lookupService.getMatchingNodesOfType(filter, ArtifactProvider.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());
}
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Provider in project halyard by spinnaker.
the class ArtifactProviderService method setEnabled.
public void setEnabled(String deploymentName, String providerName, boolean enabled) {
ArtifactProvider provider = getArtifactProvider(deploymentName, providerName);
provider.setEnabled(enabled);
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Provider in project halyard by spinnaker.
the class DeploymentEnvironmentValidator method validateDistributedDeployment.
private void validateDistributedDeployment(ConfigProblemSetBuilder p, DeploymentEnvironment n) {
String accountName = n.getAccountName();
if (StringUtils.isEmpty(accountName)) {
p.addProblem(Problem.Severity.FATAL, "An account name must be specified when using a Distributed deployment.");
return;
}
DeploymentConfiguration deploymentConfiguration = n.parentOfType(DeploymentConfiguration.class);
Account account;
try {
account = accountService.getAnyProviderAccount(deploymentConfiguration.getName(), n.getAccountName());
} catch (ConfigNotFoundException e) {
p.addProblem(Problem.Severity.FATAL, "Account " + accountName + " not defined.");
return;
}
if (account instanceof GoogleAccount) {
p.addProblem(Problem.Severity.WARNING, "Support for distributed deployments on GCE aren't fully supported yet.");
} else if (account instanceof KubernetesAccount) {
kubernetesAccountValidator.ensureKubectlExists(p);
} else {
p.addProblem(Problem.Severity.FATAL, "Account " + accountName + " is not in a provider that supports distributed installation of Spinnaker yet");
}
}
Aggregations