use of com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler 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.cli.services.v1.OperationHandler in project halyard by spinnaker.
the class AbstractEditProviderCommand method executeThis.
@Override
protected void executeThis() {
String providerName = getProviderName();
String currentDeployment = getCurrentDeployment();
Provider provider = new OperationHandler<Provider>().setFailureMesssage("Failed to get provider " + providerName + ".").setOperation(Daemon.getProvider(currentDeployment, providerName, false)).get();
int originalHash = provider.hashCode();
provider = editProvider((P) provider);
if (originalHash == provider.hashCode()) {
AnsiUi.failure("No changes supplied.");
return;
}
new OperationHandler<Void>().setFailureMesssage("Failed to edit provider " + providerName + ".").setSuccessMessage("Successfully edited provider " + providerName + ".").setOperation(Daemon.setProvider(currentDeployment, providerName, !noValidate, provider)).get();
}
use of com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler in project halyard by spinnaker.
the class ListVersionCommand method executeThis.
@Override
protected void executeThis() {
String version = new OperationHandler<String>().setOperation(Daemon.getVersion(getCurrentDeployment(), false)).setFailureMesssage("Failed to load your version of Spinnaker.").get();
Versions versions = new OperationHandler<Versions>().setOperation(Daemon.getVersions()).setFailureMesssage("Failed to load available Spinnaker versions.").setSuccessMessage("You are on version \"" + version + "\", and the following are available:").setFormat(AnsiFormatUtils.Format.STRING).setUserFormatted(true).get();
}
use of com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler in project halyard by spinnaker.
the class AbstractAddCanaryAccountCommand method executeThis.
@Override
protected void executeThis() {
String currentDeployment = getCurrentDeployment();
// Disable validation here, since we don't want an illegal config to prevent us from fixing it.
Canary canary = new OperationHandler<Canary>().setFailureMesssage("Failed to get canary.").setOperation(Daemon.getCanary(currentDeployment, false)).get();
String accountName = getAccountName();
AbstractCanaryAccount account = buildAccount(canary, accountName);
String serviceIntegration = getServiceIntegration();
new OperationHandler<Void>().setFailureMesssage("Failed to add canary account " + accountName + " for service integration " + serviceIntegration + ".").setSuccessMessage("Successfully added canary account " + accountName + " for service integration " + serviceIntegration + ".").setOperation(Daemon.addCanaryAccount(currentDeployment, serviceIntegration.toLowerCase(), !noValidate, account)).get();
}
use of com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler in project halyard by spinnaker.
the class ApiSecurityEditCommand method executeThis.
@Override
protected void executeThis() {
String currentDeployment = getCurrentDeployment();
ApiSecurity apiSecurity = new OperationHandler<ApiSecurity>().setOperation(Daemon.getApiSecurity(currentDeployment, false)).setFailureMesssage("Failed to load API security settings.").get();
int originalHash = apiSecurity.hashCode();
apiSecurity.setOverrideBaseUrl(isSet(overrideBaseUrl) ? overrideBaseUrl : apiSecurity.getOverrideBaseUrl());
apiSecurity.setCorsAccessPattern(isSet(corsAccessPattern) ? corsAccessPattern : apiSecurity.getCorsAccessPattern());
if (originalHash == apiSecurity.hashCode()) {
AnsiUi.failure("No changes supplied.");
return;
}
new OperationHandler<Void>().setOperation(Daemon.setApiSecurity(currentDeployment, !noValidate, apiSecurity)).setFailureMesssage("Failed to edit API security settings.").setFailureMesssage("Successfully updated API security settings.").get();
}
Aggregations