use of com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler in project halyard by spinnaker.
the class EditMetricStoresCommand method executeThis.
@Override
protected void executeThis() {
String currentDeployment = getCurrentDeployment();
MetricStores metricStores = new OperationHandler<MetricStores>().setOperation(Daemon.getMetricStores(currentDeployment, false)).setFailureMesssage("Failed to load metric stores.").get();
int originalHash = metricStores.hashCode();
metricStores.setPeriod(isSet(period) ? period : metricStores.getPeriod());
if (originalHash == metricStores.hashCode()) {
AnsiUi.failure("No changes supplied.");
return;
}
new OperationHandler<Void>().setOperation(Daemon.setMetricStores(currentDeployment, !noValidate, metricStores)).setFailureMesssage("Failed to edit metric stores.").setSuccessMessage("Successfully updated metric stores.").get();
}
use of com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler in project halyard by spinnaker.
the class DCOSAddClusterCommand method executeThis.
@Override
protected void executeThis() {
DCOSCluster cluster = new DCOSCluster();
cluster.setName(getClusterName()).setDcosUrl(dcosUrl).setCaCertFile(caCertFile).setInsecureSkipTlsVerify(insecureSkipTlsVerify);
if (nonNull(loadBalancerImage)) {
final DCOSCluster.LoadBalancer loadBalancer = new DCOSCluster.LoadBalancer().setImage(loadBalancerImage).setServiceAccountSecret(loadBalancerServiceAccountSecret);
cluster.setLoadBalancer(loadBalancer);
}
new OperationHandler<Void>().setFailureMesssage("Failed to add cluster " + getClusterName() + " for provider " + getProviderName() + ".").setSuccessMessage("Successfully added cluster " + getClusterName() + " for provider " + getProviderName() + ".").setOperation(Daemon.addCluster(getCurrentDeployment(), getProviderName(), !noValidate, cluster)).get();
}
use of com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler in project halyard by spinnaker.
the class AbstractEditBakeryDefaultsCommand method executeThis.
@Override
protected void executeThis() {
String providerName = getProviderName();
String currentDeployment = getCurrentDeployment();
// Disable validation here, since we don't want an illegal config to prevent us from fixing it.
BakeryDefaults defaults = new OperationHandler<BakeryDefaults>().setFailureMesssage("Failed to get bakery defaults for " + providerName + "'s bakery.").setOperation(Daemon.getBakeryDefaults(currentDeployment, providerName, false)).get();
int originalHash = defaults.hashCode();
defaults = editBakeryDefaults((T) defaults);
if (originalHash == defaults.hashCode()) {
AnsiUi.failure("No changes supplied.");
return;
}
new OperationHandler<Void>().setSuccessMessage("Successfully edited bakery defaults for " + providerName + "'s bakery.").setFailureMesssage("Failed to edit bakery defaults for " + providerName + "'s bakery.").setOperation(Daemon.setBakeryDefaults(currentDeployment, providerName, !noValidate, defaults)).get();
}
use of com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler in project halyard by spinnaker.
the class AbstractEditNotificationCommand method executeThis.
@Override
protected void executeThis() {
String notificationName = getNotificationName();
String currentDeployment = getCurrentDeployment();
// Disable validation here, since we don't want an illegal config to prevent us from fixing it.
Notification notification = new OperationHandler<Notification>().setOperation(Daemon.getNotification(currentDeployment, notificationName, !noValidate)).setFailureMesssage("Failed to get " + notificationName + ".").get();
int originalHash = notification.hashCode();
notification = editNotification((N) notification);
if (originalHash == notification.hashCode()) {
AnsiUi.failure("No changes supplied.");
return;
}
new OperationHandler<Void>().setOperation(Daemon.setNotification(currentDeployment, notificationName, !noValidate, notification)).setSuccessMessage("Edited " + notificationName + ".").setFailureMesssage("Failed to edit " + notificationName + ".").get();
}
use of com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler in project halyard by spinnaker.
the class EditPersistentStorageCommand 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.
PersistentStorage persistentStorage = new OperationHandler<PersistentStorage>().setFailureMesssage("Failed to get persistent storage.").setOperation(Daemon.getPersistentStorage(currentDeployment, false)).get();
int originalHash = persistentStorage.hashCode();
persistentStorage.setPersistentStoreType(isSet(type) ? type : persistentStorage.getPersistentStoreType());
if (originalHash == persistentStorage.hashCode()) {
AnsiUi.failure("No changes supplied.");
return;
}
new OperationHandler<Void>().setOperation(Daemon.setPersistentStorage(currentDeployment, !noValidate, persistentStorage)).setFailureMesssage("Failed to edit persistent storage.").setSuccessMessage("Successfully edited persistent storage.").get();
}
Aggregations