use of com.netflix.spinnaker.halyard.config.model.v1.node.Account 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.Account 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");
}
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Account in project halyard by spinnaker.
the class KubernetesAccount method dockerRegistriesOptions.
protected List<String> dockerRegistriesOptions(ConfigProblemSetBuilder psBuilder) {
DeploymentConfiguration context = parentOfType(DeploymentConfiguration.class);
DockerRegistryProvider dockerRegistryProvider = context.getProviders().getDockerRegistry();
if (dockerRegistryProvider != null) {
return dockerRegistryProvider.getAccounts().stream().map(Account::getName).collect(Collectors.toList());
} else {
return null;
}
}
Aggregations