Search in sources :

Example 11 with Canary

use of com.netflix.spinnaker.halyard.config.model.v1.canary.Canary in project halyard by spinnaker.

the class DatadogAddCanaryAccountCommand method buildAccount.

@Override
protected AbstractCanaryAccount buildAccount(Canary canary, String accountName) {
    DatadogCanaryAccount account = (DatadogCanaryAccount) new DatadogCanaryAccount().setName(accountName);
    account.setEndpoint(new DatadogCanaryAccount.Endpoint().setBaseUrl(baseUrl)).setApiKey(apiKey).setApplicationKey(applicationKey);
    return account;
}
Also used : DatadogCanaryAccount(com.netflix.spinnaker.halyard.config.model.v1.canary.datadog.DatadogCanaryAccount)

Example 12 with Canary

use of com.netflix.spinnaker.halyard.config.model.v1.canary.Canary in project halyard by spinnaker.

the class GoogleAddCanaryAccountCommand method buildAccount.

@Override
protected AbstractCanaryAccount buildAccount(Canary canary, String accountName) {
    GoogleCanaryAccount account = (GoogleCanaryAccount) new GoogleCanaryAccount().setName(accountName);
    account.setProject(project).setJsonPath(jsonPath);
    account.setBucket(bucket).setBucketLocation(bucketLocation);
    account.setRootFolder(isSet(rootFolder) ? rootFolder : account.getRootFolder());
    if (account.getBucket() == null) {
        String bucketName = "spin-kayenta-" + UUID.randomUUID().toString();
        AnsiUi.raw("Generated canary bucket name: " + bucketName);
        account.setBucket(bucketName);
    }
    GoogleCanaryServiceIntegration googleCanaryServiceIntegration = (GoogleCanaryServiceIntegration) CanaryUtils.getServiceIntegrationByClass(canary, GoogleCanaryServiceIntegration.class);
    if (googleCanaryServiceIntegration.isStackdriverEnabled()) {
        account.getSupportedTypes().add(AbstractCanaryServiceIntegration.SupportedTypes.METRICS_STORE);
    }
    if (googleCanaryServiceIntegration.isGcsEnabled()) {
        account.getSupportedTypes().add(AbstractCanaryServiceIntegration.SupportedTypes.CONFIGURATION_STORE);
        account.getSupportedTypes().add(AbstractCanaryServiceIntegration.SupportedTypes.OBJECT_STORE);
    }
    return account;
}
Also used : GoogleCanaryServiceIntegration(com.netflix.spinnaker.halyard.config.model.v1.canary.google.GoogleCanaryServiceIntegration) GoogleCanaryAccount(com.netflix.spinnaker.halyard.config.model.v1.canary.google.GoogleCanaryAccount)

Example 13 with Canary

use of com.netflix.spinnaker.halyard.config.model.v1.canary.Canary in project halyard by spinnaker.

the class EditCanaryAwsCommand 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();
    AwsCanaryServiceIntegration awsCanaryServiceIntegration = (AwsCanaryServiceIntegration) CanaryUtils.getServiceIntegrationByClass(canary, AwsCanaryServiceIntegration.class);
    awsCanaryServiceIntegration.setS3Enabled(isSet(s3Enabled) ? s3Enabled : awsCanaryServiceIntegration.isS3Enabled());
    if (awsCanaryServiceIntegration.isS3Enabled()) {
        awsCanaryServiceIntegration.getAccounts().forEach(a -> a.getSupportedTypes().add(AbstractCanaryServiceIntegration.SupportedTypes.CONFIGURATION_STORE));
        awsCanaryServiceIntegration.getAccounts().forEach(a -> a.getSupportedTypes().add(AbstractCanaryServiceIntegration.SupportedTypes.OBJECT_STORE));
    } else {
        awsCanaryServiceIntegration.getAccounts().forEach(a -> a.getSupportedTypes().remove(AbstractCanaryServiceIntegration.SupportedTypes.CONFIGURATION_STORE));
        awsCanaryServiceIntegration.getAccounts().forEach(a -> a.getSupportedTypes().remove(AbstractCanaryServiceIntegration.SupportedTypes.OBJECT_STORE));
    }
    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 AWS service integration settings.").setSuccessMessage("Successfully edited canary analysis AWS service integration settings.").get();
}
Also used : Canary(com.netflix.spinnaker.halyard.config.model.v1.canary.Canary) AwsCanaryServiceIntegration(com.netflix.spinnaker.halyard.config.model.v1.canary.aws.AwsCanaryServiceIntegration) OperationHandler(com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)

Example 14 with Canary

use of com.netflix.spinnaker.halyard.config.model.v1.canary.Canary in project halyard by spinnaker.

the class PrometheusAddCanaryAccountCommand method buildAccount.

@Override
protected AbstractCanaryAccount buildAccount(Canary canary, String accountName) {
    PrometheusCanaryAccount account = (PrometheusCanaryAccount) new PrometheusCanaryAccount().setName(accountName);
    account.setEndpoint(new PrometheusCanaryAccount.Endpoint().setBaseUrl(baseUrl));
    return account;
}
Also used : PrometheusCanaryAccount(com.netflix.spinnaker.halyard.config.model.v1.canary.prometheus.PrometheusCanaryAccount)

Example 15 with Canary

use of com.netflix.spinnaker.halyard.config.model.v1.canary.Canary in project halyard by spinnaker.

the class EditCanaryGoogleCommand 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();
    GoogleCanaryServiceIntegration googleCanaryServiceIntegration = (GoogleCanaryServiceIntegration) CanaryUtils.getServiceIntegrationByClass(canary, GoogleCanaryServiceIntegration.class);
    googleCanaryServiceIntegration.setGcsEnabled(isSet(gcsEnabled) ? gcsEnabled : googleCanaryServiceIntegration.isGcsEnabled());
    googleCanaryServiceIntegration.setStackdriverEnabled(isSet(stackdriverEnabled) ? stackdriverEnabled : googleCanaryServiceIntegration.isStackdriverEnabled());
    googleCanaryServiceIntegration.setMetadataCachingIntervalMS(isSet(metadataCachingIntervalMS) ? metadataCachingIntervalMS : googleCanaryServiceIntegration.getMetadataCachingIntervalMS());
    if (googleCanaryServiceIntegration.isStackdriverEnabled()) {
        googleCanaryServiceIntegration.getAccounts().forEach(a -> a.getSupportedTypes().add(AbstractCanaryServiceIntegration.SupportedTypes.METRICS_STORE));
    } else {
        googleCanaryServiceIntegration.getAccounts().forEach(a -> a.getSupportedTypes().remove(AbstractCanaryServiceIntegration.SupportedTypes.METRICS_STORE));
    }
    if (googleCanaryServiceIntegration.isGcsEnabled()) {
        googleCanaryServiceIntegration.getAccounts().forEach(a -> a.getSupportedTypes().add(AbstractCanaryServiceIntegration.SupportedTypes.CONFIGURATION_STORE));
        googleCanaryServiceIntegration.getAccounts().forEach(a -> a.getSupportedTypes().add(AbstractCanaryServiceIntegration.SupportedTypes.OBJECT_STORE));
    } else {
        googleCanaryServiceIntegration.getAccounts().forEach(a -> a.getSupportedTypes().remove(AbstractCanaryServiceIntegration.SupportedTypes.CONFIGURATION_STORE));
        googleCanaryServiceIntegration.getAccounts().forEach(a -> a.getSupportedTypes().remove(AbstractCanaryServiceIntegration.SupportedTypes.OBJECT_STORE));
    }
    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 Google service integration settings.").setSuccessMessage("Successfully edited canary analysis Google service integration settings.").get();
}
Also used : GoogleCanaryServiceIntegration(com.netflix.spinnaker.halyard.config.model.v1.canary.google.GoogleCanaryServiceIntegration) Canary(com.netflix.spinnaker.halyard.config.model.v1.canary.Canary) OperationHandler(com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)

Aggregations

Canary (com.netflix.spinnaker.halyard.config.model.v1.canary.Canary)10 OperationHandler (com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)7 AbstractCanaryAccount (com.netflix.spinnaker.halyard.config.model.v1.canary.AbstractCanaryAccount)6 AbstractCanaryServiceIntegration (com.netflix.spinnaker.halyard.config.model.v1.canary.AbstractCanaryServiceIntegration)3 UpdateRequestBuilder (com.netflix.spinnaker.halyard.core.DaemonResponse.UpdateRequestBuilder)3 ProblemSet (com.netflix.spinnaker.halyard.core.problem.v1.ProblemSet)3 Path (java.nio.file.Path)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 AwsCanaryServiceIntegration (com.netflix.spinnaker.halyard.config.model.v1.canary.aws.AwsCanaryServiceIntegration)2 GoogleCanaryServiceIntegration (com.netflix.spinnaker.halyard.config.model.v1.canary.google.GoogleCanaryServiceIntegration)2 ConfigProblemBuilder (com.netflix.spinnaker.halyard.config.problem.v1.ConfigProblemBuilder)2 ConfigNotFoundException (com.netflix.spinnaker.halyard.config.error.v1.ConfigNotFoundException)1 IllegalConfigException (com.netflix.spinnaker.halyard.config.error.v1.IllegalConfigException)1 AwsCanaryAccount (com.netflix.spinnaker.halyard.config.model.v1.canary.aws.AwsCanaryAccount)1 DatadogCanaryAccount (com.netflix.spinnaker.halyard.config.model.v1.canary.datadog.DatadogCanaryAccount)1 GoogleCanaryAccount (com.netflix.spinnaker.halyard.config.model.v1.canary.google.GoogleCanaryAccount)1 PrometheusCanaryAccount (com.netflix.spinnaker.halyard.config.model.v1.canary.prometheus.PrometheusCanaryAccount)1 PrometheusCanaryServiceIntegration (com.netflix.spinnaker.halyard.config.model.v1.canary.prometheus.PrometheusCanaryServiceIntegration)1 DeploymentConfiguration (com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration)1 Features (com.netflix.spinnaker.halyard.config.model.v1.node.Features)1