use of com.netflix.spinnaker.halyard.config.model.v1.node.ArtifactAccount in project halyard by spinnaker.
the class ArtifactAccountService method deleteArtifactAccount.
public void deleteArtifactAccount(String deploymentName, String providerName, String accountName) {
ArtifactProvider provider = artifactProviderService.getArtifactProvider(deploymentName, providerName);
boolean removed = provider.getAccounts().removeIf(account -> ((ArtifactAccount) account).getName().equals(accountName));
if (!removed) {
throw new HalException(new ConfigProblemBuilder(Severity.FATAL, "Artifact account \"" + accountName + "\" wasn't found").build());
}
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.ArtifactAccount in project halyard by spinnaker.
the class AbstractArtifactEditAccountCommand method executeThis.
@Override
protected void executeThis() {
String accountName = getArtifactAccountName();
String providerName = getArtifactProviderName();
String currentDeployment = getCurrentDeployment();
// Disable validation here, since we don't want an illegal config to prevent us from fixing it.
ArtifactAccount account = new OperationHandler<ArtifactAccount>().setFailureMesssage("Failed to get account " + accountName + " for provider " + providerName + ".").setOperation(Daemon.getArtifactAccount(currentDeployment, providerName, accountName, false)).get();
int originaHash = account.hashCode();
account = editArtifactAccount((T) account);
if (originaHash == account.hashCode()) {
AnsiUi.failure("No changes supplied.");
return;
}
new OperationHandler<Void>().setFailureMesssage("Failed to edit artifact account " + accountName + " for artifact provider " + providerName + ".").setSuccessMessage("Successfully edited artifact account " + accountName + " for artifact provider " + providerName + ".").setOperation(Daemon.setArtifactAccount(currentDeployment, providerName, accountName, !noValidate, account)).get();
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.ArtifactAccount in project halyard by spinnaker.
the class AbstractListArtifactAccountsCommand method executeThis.
@Override
protected void executeThis() {
ArtifactProvider provider = getArtifactProvider();
List<ArtifactAccount> accounts = provider.getAccounts();
if (accounts.isEmpty()) {
AnsiUi.success("No configured artifact accounts for " + getArtifactProviderName() + ".");
} else {
AnsiUi.success("Artifact accounts for " + getArtifactProviderName() + ":");
accounts.forEach(account -> AnsiUi.listItem(account.getName()));
}
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.ArtifactAccount in project halyard by spinnaker.
the class HttpAddArtifactAccountCommand method buildArtifactAccount.
@Override
protected ArtifactAccount buildArtifactAccount(String accountName) {
HttpArtifactAccount artifactAccount = new HttpArtifactAccount().setName(accountName);
artifactAccount.setUsername(username).setPassword(password).setUsernamePasswordFile(usernamePasswordFile);
return artifactAccount;
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.ArtifactAccount in project halyard by spinnaker.
the class ArtifactAccountService method addArtifactAccount.
public void addArtifactAccount(String deploymentName, String providerName, ArtifactAccount newArtifactAccount) {
ArtifactProvider provider = artifactProviderService.getArtifactProvider(deploymentName, providerName);
provider.getAccounts().add(newArtifactAccount);
}
Aggregations