Search in sources :

Example 6 with OperationHandler

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();
}
Also used : MetricStores(com.netflix.spinnaker.halyard.config.model.v1.node.MetricStores) OperationHandler(com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)

Example 7 with OperationHandler

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();
}
Also used : DCOSCluster(com.netflix.spinnaker.halyard.config.model.v1.providers.dcos.DCOSCluster) OperationHandler(com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)

Example 8 with OperationHandler

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();
}
Also used : BakeryDefaults(com.netflix.spinnaker.halyard.config.model.v1.node.BakeryDefaults) OperationHandler(com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)

Example 9 with OperationHandler

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();
}
Also used : Notification(com.netflix.spinnaker.halyard.config.model.v1.node.Notification) OperationHandler(com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)

Example 10 with OperationHandler

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();
}
Also used : PersistentStorage(com.netflix.spinnaker.halyard.config.model.v1.node.PersistentStorage) OperationHandler(com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)

Aggregations

OperationHandler (com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)38 Canary (com.netflix.spinnaker.halyard.config.model.v1.canary.Canary)6 AbstractCanaryAccount (com.netflix.spinnaker.halyard.config.model.v1.canary.AbstractCanaryAccount)2 Account (com.netflix.spinnaker.halyard.config.model.v1.node.Account)2 ArtifactAccount (com.netflix.spinnaker.halyard.config.model.v1.node.ArtifactAccount)2 BaseImage (com.netflix.spinnaker.halyard.config.model.v1.node.BaseImage)2 Master (com.netflix.spinnaker.halyard.config.model.v1.node.Master)2 Subscription (com.netflix.spinnaker.halyard.config.model.v1.node.Subscription)2 DCOSCluster (com.netflix.spinnaker.halyard.config.model.v1.providers.dcos.DCOSCluster)2 Versions (com.netflix.spinnaker.halyard.core.registry.v1.Versions)2 AbstractCanaryServiceIntegration (com.netflix.spinnaker.halyard.config.model.v1.canary.AbstractCanaryServiceIntegration)1 AwsCanaryServiceIntegration (com.netflix.spinnaker.halyard.config.model.v1.canary.aws.AwsCanaryServiceIntegration)1 GoogleCanaryServiceIntegration (com.netflix.spinnaker.halyard.config.model.v1.canary.google.GoogleCanaryServiceIntegration)1 PrometheusCanaryServiceIntegration (com.netflix.spinnaker.halyard.config.model.v1.canary.prometheus.PrometheusCanaryServiceIntegration)1 BakeryDefaults (com.netflix.spinnaker.halyard.config.model.v1.node.BakeryDefaults)1 DeploymentConfiguration (com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration)1 DeploymentEnvironment (com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentEnvironment)1 Features (com.netflix.spinnaker.halyard.config.model.v1.node.Features)1 MetricStore (com.netflix.spinnaker.halyard.config.model.v1.node.MetricStore)1 MetricStores (com.netflix.spinnaker.halyard.config.model.v1.node.MetricStores)1