use of com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler in project halyard by spinnaker.
the class EditFeaturesCommand method executeThis.
@Override
protected void executeThis() {
String currentDeployment = getCurrentDeployment();
Features features = new OperationHandler<Features>().setOperation(Daemon.getFeatures(currentDeployment, false)).setFailureMesssage("Failed to load features.").get();
int originalHash = features.hashCode();
features.setChaos(chaos != null ? chaos : features.isChaos());
features.setJobs(jobs != null ? jobs : features.isJobs());
features.setPipelineTemplates(pipelineTemplates != null ? pipelineTemplates : features.getPipelineTemplates());
features.setArtifacts(artifacts != null ? artifacts : features.getArtifacts());
features.setMineCanary(mineCanary != null ? mineCanary : features.getMineCanary());
features.setInfrastructureStages(infrastructureStages != null ? infrastructureStages : features.getInfrastructureStages());
if (originalHash == features.hashCode()) {
AnsiUi.failure("No changes supplied.");
return;
}
new OperationHandler<Void>().setOperation(Daemon.setFeatures(currentDeployment, !noValidate, features)).setSuccessMessage("Successfully updated features.").setFailureMesssage("Failed to edit features.").get();
}
use of com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler 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.cli.services.v1.OperationHandler in project halyard by spinnaker.
the class AbstractAddMasterCommand method executeThis.
@Override
protected void executeThis() {
String masterName = getMasterName();
Master master = buildMaster(masterName);
String ciName = getCiName();
String currentDeployment = getCurrentDeployment();
new OperationHandler<Void>().setOperation(Daemon.addMaster(currentDeployment, ciName, !noValidate, master)).setSuccessMessage("Added " + masterName + " for " + ciName + ".").setFailureMesssage("Failed to add " + masterName + " for " + ciName + ".").get();
}
use of com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler in project halyard by spinnaker.
the class AbstractEditMasterCommand method executeThis.
@Override
protected void executeThis() {
String masterName = getMasterName();
String ciName = getCiName();
String currentDeployment = getCurrentDeployment();
// Disable validation here, since we don't want an illegal config to prevent us from fixing it.
Master master = new OperationHandler<Master>().setOperation(Daemon.getMaster(currentDeployment, ciName, masterName, !noValidate)).setFailureMesssage("Failed to get " + masterName + " under " + ciName + ".").get();
int originalHash = master.hashCode();
master = editMaster((T) master);
if (originalHash == master.hashCode()) {
AnsiUi.failure("No changes supplied.");
return;
}
new OperationHandler<Void>().setOperation(Daemon.setMaster(currentDeployment, ciName, masterName, !noValidate, master)).setSuccessMessage("Edited " + masterName + " for " + ciName + ".").setFailureMesssage("Failed to edit " + masterName + " for " + ciName + ".").get();
}
use of com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler in project halyard by spinnaker.
the class AbstractEditMetricStoreCommand method executeThis.
@Override
protected void executeThis() {
String currentDeployment = getCurrentDeployment();
String metricStoreType = getMetricStoreType().getId();
// Disable validation here, since we don't want an illegal config to prevent us from fixing it.
MetricStore metricStore = new OperationHandler<MetricStore>().setOperation(Daemon.getMetricStore(currentDeployment, metricStoreType, false)).setFailureMesssage("Failed to get " + metricStoreType + " method.").get();
int originalHash = metricStore.hashCode();
metricStore = editMetricStore((T) metricStore);
if (originalHash == metricStore.hashCode()) {
AnsiUi.failure("No changes supplied.");
return;
}
new OperationHandler<Void>().setOperation(Daemon.setMetricStore(currentDeployment, metricStoreType, !noValidate, metricStore)).setFailureMesssage("Failed to edit " + metricStoreType + " method.").setSuccessMessage("Successfully edited " + metricStoreType + " method.").get();
}
Aggregations