use of com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler in project halyard by spinnaker.
the class AbstractEditAuthnMethodCommand method executeThis.
@Override
protected void executeThis() {
String currentDeployment = getCurrentDeployment();
String authnMethodName = getMethod().id;
// Disable validation here, since we don't want an illegal config to prevent us from fixing it.
AuthnMethod authnMethod = new OperationHandler<AuthnMethod>().setOperation(Daemon.getAuthnMethod(currentDeployment, authnMethodName, false)).setFailureMesssage("Failed to get " + authnMethodName + " method.").get();
new OperationHandler<Void>().setOperation(Daemon.setAuthnMethod(currentDeployment, authnMethodName, !noValidate, editAuthnMethod((T) authnMethod))).setFailureMesssage("Failed to edit " + authnMethodName + " method.").setSuccessMessage("Successfully edited " + authnMethodName + " method.").get();
}
use of com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler in project halyard by spinnaker.
the class AuthzEditCommand method executeThis.
@Override
protected void executeThis() {
String currentDeployment = getCurrentDeployment();
GroupMembership membership = new OperationHandler<GroupMembership>().setOperation(Daemon.getGroupMembership(currentDeployment, false)).setFailureMesssage("Failed to get configured roles.").get();
membership.setService(type != null ? type : membership.getService());
new OperationHandler<Void>().setOperation(Daemon.setGroupMembership(currentDeployment, !noValidate, membership)).setFailureMesssage("Failed to set configured roles.").setSuccessMessage("Successfully updated roles.").get();
}
use of com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler in project halyard by spinnaker.
the class ApacheSslEditCommand method executeThis.
@Override
protected void executeThis() {
String currentDeployment = getCurrentDeployment();
ApacheSsl apacheSsl = new OperationHandler<ApacheSsl>().setOperation(Daemon.getApacheSsl(currentDeployment, false)).setFailureMesssage("Failed to load SSL settings.").get();
int originalHash = apacheSsl.hashCode();
apacheSsl.setSslCertificateFile(isSet(sslCertificateFile) ? sslCertificateFile : apacheSsl.getSslCertificateFile());
apacheSsl.setSslCertificateKeyFile(isSet(sslCertificateKeyFile) ? sslCertificateKeyFile : apacheSsl.getSslCertificateKeyFile());
apacheSsl.setSslCertificatePassphrase(isSet(sslCertificatePassphrase) ? sslCertificatePassphrase : apacheSsl.getSslCertificatePassphrase());
if (originalHash == apacheSsl.hashCode()) {
AnsiUi.failure("No changes supplied.");
return;
}
new OperationHandler<Void>().setOperation(Daemon.setApacheSsl(currentDeployment, !noValidate, apacheSsl)).setFailureMesssage("Failed to edit SSL settings.").setSuccessMessage("Successfully updated SSL settings.").get();
}
use of com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler in project halyard by spinnaker.
the class AbstractAddAccountCommand method executeThis.
@Override
protected void executeThis() {
String accountName = getAccountName();
Account account = buildAccount(accountName);
account.setRequiredGroupMembership(requiredGroupMembership);
account.setProviderVersion(providerVersion);
String providerName = getProviderName();
String currentDeployment = getCurrentDeployment();
new OperationHandler<Void>().setFailureMesssage("Failed to add account " + accountName + " for provider " + providerName + ".").setSuccessMessage("Successfully added account " + accountName + " for provider " + providerName + ".").setOperation(Daemon.addAccount(currentDeployment, providerName, !noValidate, account)).get();
}
use of com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler in project halyard by spinnaker.
the class AbstractEditAccountCommand method executeThis.
@Override
protected void executeThis() {
String accountName = getAccountName();
String providerName = getProviderName();
String currentDeployment = getCurrentDeployment();
// Disable validation here, since we don't want an illegal config to prevent us from fixing it.
Account account = new OperationHandler<Account>().setFailureMesssage("Failed to get account " + accountName + " for provider " + providerName + ".").setOperation(Daemon.getAccount(currentDeployment, providerName, accountName, false)).get();
int originaHash = account.hashCode();
account = editAccount((T) account);
account.setRequiredGroupMembership(updateStringList(account.getRequiredGroupMembership(), requiredGroupMembership, addRequiredGroupMembership, removeRequiredGroupMembership));
account.setProviderVersion(isSet(providerVersion) ? providerVersion : account.getProviderVersion());
if (originaHash == account.hashCode()) {
AnsiUi.failure("No changes supplied.");
return;
}
new OperationHandler<Void>().setFailureMesssage("Failed to edit account " + accountName + " for provider " + providerName + ".").setSuccessMessage("Successfully edited account " + accountName + " for provider " + providerName + ".").setOperation(Daemon.setAccount(currentDeployment, providerName, accountName, !noValidate, account)).get();
}
Aggregations