Search in sources :

Example 1 with EDITED

use of com.netflix.spinnaker.halyard.config.model.v1.node.NodeDiff.ChangeType.EDITED 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();
}
Also used : Master(com.netflix.spinnaker.halyard.config.model.v1.node.Master) OperationHandler(com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)

Example 2 with EDITED

use of com.netflix.spinnaker.halyard.config.model.v1.node.NodeDiff.ChangeType.EDITED 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();
}
Also used : MetricStore(com.netflix.spinnaker.halyard.config.model.v1.node.MetricStore) OperationHandler(com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)

Example 3 with EDITED

use of com.netflix.spinnaker.halyard.config.model.v1.node.NodeDiff.ChangeType.EDITED 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 4 with EDITED

use of com.netflix.spinnaker.halyard.config.model.v1.node.NodeDiff.ChangeType.EDITED 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 5 with EDITED

use of com.netflix.spinnaker.halyard.config.model.v1.node.NodeDiff.ChangeType.EDITED 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)20 Canary (com.netflix.spinnaker.halyard.config.model.v1.canary.Canary)4 AbstractCanaryAccount (com.netflix.spinnaker.halyard.config.model.v1.canary.AbstractCanaryAccount)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 Account (com.netflix.spinnaker.halyard.config.model.v1.node.Account)1 ArtifactAccount (com.netflix.spinnaker.halyard.config.model.v1.node.ArtifactAccount)1 BakeryDefaults (com.netflix.spinnaker.halyard.config.model.v1.node.BakeryDefaults)1 BaseImage (com.netflix.spinnaker.halyard.config.model.v1.node.BaseImage)1 DeploymentConfiguration (com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration)1 Master (com.netflix.spinnaker.halyard.config.model.v1.node.Master)1 MetricStore (com.netflix.spinnaker.halyard.config.model.v1.node.MetricStore)1 NodeDiff (com.netflix.spinnaker.halyard.config.model.v1.node.NodeDiff)1 Notification (com.netflix.spinnaker.halyard.config.model.v1.node.Notification)1 PersistentStorage (com.netflix.spinnaker.halyard.config.model.v1.node.PersistentStorage)1 PersistentStore (com.netflix.spinnaker.halyard.config.model.v1.node.PersistentStore)1 Provider (com.netflix.spinnaker.halyard.config.model.v1.node.Provider)1 Subscription (com.netflix.spinnaker.halyard.config.model.v1.node.Subscription)1 DCOSCluster (com.netflix.spinnaker.halyard.config.model.v1.providers.dcos.DCOSCluster)1