use of com.netflix.spinnaker.halyard.config.model.v1.node.Account in project halyard by spinnaker.
the class AbstractAddArtifactAccountCommand method executeThis.
@Override
protected void executeThis() {
String accountName = getArtifactAccountName();
ArtifactAccount account = buildArtifactAccount(accountName);
String providerName = getArtifactProviderName();
String currentDeployment = getCurrentDeployment();
new OperationHandler<Void>().setFailureMesssage("Failed to add artifact account " + accountName + " for artifact provider " + providerName + ".").setSuccessMessage("Successfully added artifact account " + accountName + " for artifact provider " + providerName + ".").setOperation(Daemon.addArtifactAccount(currentDeployment, providerName, !noValidate, account)).get();
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Account in project halyard by spinnaker.
the class GoogleProviderUtils method defaultServiceAccount.
static String defaultServiceAccount(AccountDeploymentDetails<GoogleAccount> details) {
GoogleAccount account = details.getAccount();
String project = account.getProject();
Compute compute = getCompute(details);
try {
return compute.projects().get(project).execute().getDefaultServiceAccount();
} catch (IOException e) {
throw new HalException(FATAL, "Unable to get default compute service account");
}
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Account in project halyard by spinnaker.
the class DCOSEditAccountCommand method editAccount.
@Override
protected Account editAccount(DCOSAccount account) {
if (!removeCredential.isEmpty()) {
account.removeCredential(removeCredential.get(0), removeCredential.get(1));
}
if (!updateUserCredential.isEmpty()) {
validateCredential(updateUserCredential);
final String clusterName = updateUserCredential.get(0);
final String uid = updateUserCredential.get(1);
final String password = updateUserCredential.get(2);
account.removeCredential(clusterName, uid);
final DCOSAccount.ClusterCredential credential = new DCOSAccount.ClusterCredential(clusterName, uid, password, null);
account.getClusters().add(credential);
}
if (!updateServiceCredential.isEmpty()) {
validateCredential(updateServiceCredential);
final String clusterName = updateServiceCredential.get(0);
final String uid = updateServiceCredential.get(1);
final String serviceKeyFile = updateServiceCredential.get(2);
account.removeCredential(clusterName, uid);
final DCOSAccount.ClusterCredential credential = new DCOSAccount.ClusterCredential(clusterName, uid, null, serviceKeyFile);
account.getClusters().add(credential);
}
try {
List<String> oldRegistries = account.getDockerRegistries().stream().map(DockerRegistryReference::getAccountName).collect(Collectors.toList());
List<DockerRegistryReference> newRegistries = updateStringList(oldRegistries, dockerRegistries, addDockerRegistry, removeDockerRegistry).stream().map(s -> new DockerRegistryReference().setAccountName(s)).collect(Collectors.toList());
account.setDockerRegistries(newRegistries);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Set either --docker-registries or --[add/remove]-docker-registry");
}
return account;
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Account in project halyard by spinnaker.
the class AbstractEditCanaryAccountCommand method executeThis.
@Override
protected void executeThis() {
String accountName = getAccountName();
String serviceIntegration = getServiceIntegration();
String currentDeployment = getCurrentDeployment();
// Disable validation here, since we don't want an illegal config to prevent us from fixing it.
AbstractCanaryAccount account = new OperationHandler<AbstractCanaryAccount>().setFailureMesssage("Failed to get canary account " + accountName + " for service integration " + serviceIntegration + ".").setOperation(Daemon.getCanaryAccount(currentDeployment, serviceIntegration.toLowerCase(), accountName, false)).get();
int originaHash = account.hashCode();
account = editAccount((T) account);
if (originaHash == account.hashCode()) {
AnsiUi.failure("No changes supplied.");
return;
}
new OperationHandler<Void>().setFailureMesssage("Failed to edit canary account " + accountName + " for service integration " + serviceIntegration + ".").setSuccessMessage("Successfully edited canary account " + accountName + " for service integration " + serviceIntegration + ".").setOperation(Daemon.setCanaryAccount(currentDeployment, serviceIntegration.toLowerCase(), accountName, !noValidate, account)).get();
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Account in project halyard by spinnaker.
the class KubernetesAddAccountCommand method buildAccount.
@Override
protected Account buildAccount(String accountName) {
KubernetesAccount account = (KubernetesAccount) new KubernetesAccount().setName(accountName);
account.setContext(context);
account.setKubeconfigFile(kubeconfigFile);
account.setNamespaces(namespaces);
account.setOmitNamespaces(omitNamespaces);
account.setKinds(namespaces);
account.setOmitKinds(omitKinds);
account.setConfigureImagePullSecrets(configureImagePullSecrets);
account.setServiceAccount(serviceAccount);
dockerRegistries.forEach(registryName -> account.getDockerRegistries().add(new DockerRegistryReference().setAccountName(registryName)));
account.setOAuthServiceAccount(oAuthServiceAccount);
account.setOAuthScopes(oAuthScopes);
account.setNamingStrategy(namingStrategy);
account.setSkin(skin);
return account;
}
Aggregations