Search in sources :

Example 61 with Account

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());
    }
}
Also used : Account(com.netflix.spinnaker.halyard.config.model.v1.node.Account) ConfigProblemBuilder(com.netflix.spinnaker.halyard.config.problem.v1.ConfigProblemBuilder) HalException(com.netflix.spinnaker.halyard.core.error.v1.HalException) Provider(com.netflix.spinnaker.halyard.config.model.v1.node.Provider)

Example 62 with Account

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");
    }
}
Also used : KubernetesAccount(com.netflix.spinnaker.halyard.config.model.v1.providers.kubernetes.KubernetesAccount) Account(com.netflix.spinnaker.halyard.config.model.v1.node.Account) GoogleAccount(com.netflix.spinnaker.halyard.config.model.v1.providers.google.GoogleAccount) GoogleAccount(com.netflix.spinnaker.halyard.config.model.v1.providers.google.GoogleAccount) ConfigNotFoundException(com.netflix.spinnaker.halyard.config.error.v1.ConfigNotFoundException) KubernetesAccount(com.netflix.spinnaker.halyard.config.model.v1.providers.kubernetes.KubernetesAccount) DeploymentConfiguration(com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration)

Example 63 with Account

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;
    }
}
Also used : DockerRegistryProvider(com.netflix.spinnaker.halyard.config.model.v1.providers.dockerRegistry.DockerRegistryProvider) DeploymentConfiguration(com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration)

Aggregations

Account (com.netflix.spinnaker.halyard.config.model.v1.node.Account)19 List (java.util.List)13 Provider (com.netflix.spinnaker.halyard.config.model.v1.node.Provider)11 KubernetesAccount (com.netflix.spinnaker.halyard.config.model.v1.providers.kubernetes.KubernetesAccount)11 HalException (com.netflix.spinnaker.halyard.core.error.v1.HalException)11 Collectors (java.util.stream.Collectors)10 DeploymentConfiguration (com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration)9 ConfigProblemBuilder (com.netflix.spinnaker.halyard.config.problem.v1.ConfigProblemBuilder)8 ArrayList (java.util.ArrayList)8 AbstractCanaryAccount (com.netflix.spinnaker.halyard.config.model.v1.canary.AbstractCanaryAccount)7 Path (java.nio.file.Path)7 OperationHandler (com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)6 ArtifactAccount (com.netflix.spinnaker.halyard.config.model.v1.node.ArtifactAccount)6 DockerRegistryReference (com.netflix.spinnaker.halyard.config.model.v1.providers.containers.DockerRegistryReference)6 GoogleAccount (com.netflix.spinnaker.halyard.config.model.v1.providers.google.GoogleAccount)6 UpdateRequestBuilder (com.netflix.spinnaker.halyard.core.DaemonResponse.UpdateRequestBuilder)6 ServiceSettings (com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.ServiceSettings)6 IOException (java.io.IOException)5 Collections (java.util.Collections)5 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)5