Search in sources :

Example 1 with PrometheusCanaryServiceIntegration

use of com.netflix.spinnaker.halyard.config.model.v1.canary.prometheus.PrometheusCanaryServiceIntegration 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)

Aggregations

OperationHandler (com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)1 Canary (com.netflix.spinnaker.halyard.config.model.v1.canary.Canary)1 PrometheusCanaryServiceIntegration (com.netflix.spinnaker.halyard.config.model.v1.canary.prometheus.PrometheusCanaryServiceIntegration)1