Search in sources :

Example 36 with OperationHandler

use of com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler in project halyard by spinnaker.

the class EditCanaryPrometheusCommand 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();
    int originalHash = canary.hashCode();
    PrometheusCanaryServiceIntegration prometheusCanaryServiceIntegration = (PrometheusCanaryServiceIntegration) CanaryUtils.getServiceIntegrationByClass(canary, PrometheusCanaryServiceIntegration.class);
    prometheusCanaryServiceIntegration.setMetadataCachingIntervalMS(isSet(metadataCachingIntervalMS) ? metadataCachingIntervalMS : prometheusCanaryServiceIntegration.getMetadataCachingIntervalMS());
    if (originalHash == canary.hashCode()) {
        AnsiUi.failure("No changes supplied.");
        return;
    }
    new OperationHandler<Void>().setOperation(Daemon.setCanary(currentDeployment, !noValidate, canary)).setFailureMesssage("Failed to edit canary analysis Prometheus service integration settings.").setSuccessMessage("Successfully edited canary analysis Prometheus service integration settings.").get();
}
Also used : PrometheusCanaryServiceIntegration(com.netflix.spinnaker.halyard.config.model.v1.canary.prometheus.PrometheusCanaryServiceIntegration) Canary(com.netflix.spinnaker.halyard.config.model.v1.canary.Canary) OperationHandler(com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)

Example 37 with OperationHandler

use of com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler in project halyard by spinnaker.

the class AbstractEnableDisableCanaryServiceIntegrationCommand 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();
    int originalHash = canary.hashCode();
    AbstractCanaryServiceIntegration canaryServiceIntegration = CanaryUtils.getServiceIntegrationByName(canary, currentDeployment, getName(), true);
    canaryServiceIntegration.setEnabled(isEnable());
    if (originalHash == canary.hashCode()) {
        AnsiUi.failure("No changes supplied.");
        return;
    }
    new OperationHandler<Void>().setSuccessMessage("Successfully " + indicativePastPerfectAction() + " canary analysis " + getName() + " service integration.").setFailureMesssage("Failed to " + getCommandName() + " canary analysis " + getName() + " service integration.").setOperation(Daemon.setCanary(currentDeployment, !noValidate, canary)).get();
}
Also used : AbstractCanaryServiceIntegration(com.netflix.spinnaker.halyard.config.model.v1.canary.AbstractCanaryServiceIntegration) Canary(com.netflix.spinnaker.halyard.config.model.v1.canary.Canary) OperationHandler(com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)

Example 38 with OperationHandler

use of com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler in project halyard by spinnaker.

the class EditCanaryCommand 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();
    int originalHash = canary.hashCode();
    canary.setReduxLoggerEnabled(isSet(reduxLoggerEnabled) ? reduxLoggerEnabled : canary.isReduxLoggerEnabled());
    canary.setDefaultMetricsAccount(isSet(defaultMetricsAccount) ? defaultMetricsAccount : canary.getDefaultMetricsAccount());
    canary.setDefaultStorageAccount(isSet(defaultStorageAccount) ? defaultStorageAccount : canary.getDefaultStorageAccount());
    canary.setDefaultJudge(isSet(defaultJudge) ? defaultJudge : canary.getDefaultJudge());
    canary.setDefaultMetricsStore(isSet(defaultMetricsStore) ? defaultMetricsStore : canary.getDefaultMetricsStore());
    canary.setStagesEnabled(isSet(stagesEnabled) ? stagesEnabled : canary.isStagesEnabled());
    canary.setAtlasWebComponentsUrl(isSet(atlasWebComponentsUrl) ? atlasWebComponentsUrl : canary.getAtlasWebComponentsUrl());
    canary.setTemplatesEnabled(isSet(templatesEnabled) ? templatesEnabled : canary.isTemplatesEnabled());
    canary.setShowAllConfigsEnabled(isSet(showAllConfigsEnabled) ? showAllConfigsEnabled : canary.isShowAllConfigsEnabled());
    if (originalHash == canary.hashCode()) {
        AnsiUi.failure("No changes supplied.");
        return;
    }
    new OperationHandler<Void>().setOperation(Daemon.setCanary(currentDeployment, !noValidate, canary)).setFailureMesssage("Failed to edit canary analysis settings.").setSuccessMessage("Successfully edited canary analysis settings.").get();
}
Also used : Canary(com.netflix.spinnaker.halyard.config.model.v1.canary.Canary) 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