Search in sources :

Example 6 with AbstractCanaryAccount

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

the class AbstractAddCanaryAccountCommand 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();
    String accountName = getAccountName();
    AbstractCanaryAccount account = buildAccount(canary, accountName);
    String serviceIntegration = getServiceIntegration();
    new OperationHandler<Void>().setFailureMesssage("Failed to add canary account " + accountName + " for service integration " + serviceIntegration + ".").setSuccessMessage("Successfully added canary account " + accountName + " for service integration " + serviceIntegration + ".").setOperation(Daemon.addCanaryAccount(currentDeployment, serviceIntegration.toLowerCase(), !noValidate, account)).get();
}
Also used : Canary(com.netflix.spinnaker.halyard.config.model.v1.canary.Canary) AbstractCanaryAccount(com.netflix.spinnaker.halyard.config.model.v1.canary.AbstractCanaryAccount) OperationHandler(com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)

Example 7 with AbstractCanaryAccount

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

the class ListCanaryAccountsCommand method executeThis.

@Override
protected void executeThis() {
    AbstractCanaryServiceIntegration serviceIntegration = CanaryUtils.getServiceIntegrationByName(null, getCurrentDeployment(), getServiceIntegration(), noValidate);
    List<AbstractCanaryAccount> accounts = serviceIntegration.getAccounts();
    if (accounts.isEmpty()) {
        AnsiUi.success("No configured accounts for " + getServiceIntegration() + ".");
    } else {
        AnsiUi.success("Accounts for " + getServiceIntegration() + ":");
        accounts.forEach(account -> AnsiUi.listItem(account.getName()));
    }
}
Also used : AbstractCanaryServiceIntegration(com.netflix.spinnaker.halyard.config.model.v1.canary.AbstractCanaryServiceIntegration) AbstractCanaryAccount(com.netflix.spinnaker.halyard.config.model.v1.canary.AbstractCanaryAccount)

Example 8 with AbstractCanaryAccount

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

the class AwsAddCanaryAccountCommand method buildAccount.

@Override
protected AbstractCanaryAccount buildAccount(Canary canary, String accountName) {
    AwsCanaryAccount account = (AwsCanaryAccount) new AwsCanaryAccount().setName(accountName);
    account.setBucket(bucket);
    account.setRootFolder(isSet(rootFolder) ? rootFolder : account.getRootFolder());
    AwsCanaryServiceIntegration awsCanaryServiceIntegration = (AwsCanaryServiceIntegration) CanaryUtils.getServiceIntegrationByClass(canary, AwsCanaryServiceIntegration.class);
    if (awsCanaryServiceIntegration.isS3Enabled()) {
        account.getSupportedTypes().add(AbstractCanaryServiceIntegration.SupportedTypes.CONFIGURATION_STORE);
        account.getSupportedTypes().add(AbstractCanaryServiceIntegration.SupportedTypes.OBJECT_STORE);
    }
    return account;
}
Also used : AwsCanaryAccount(com.netflix.spinnaker.halyard.config.model.v1.canary.aws.AwsCanaryAccount) AwsCanaryServiceIntegration(com.netflix.spinnaker.halyard.config.model.v1.canary.aws.AwsCanaryServiceIntegration)

Example 9 with AbstractCanaryAccount

use of com.netflix.spinnaker.halyard.config.model.v1.canary.AbstractCanaryAccount 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 10 with AbstractCanaryAccount

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

Aggregations

AbstractCanaryAccount (com.netflix.spinnaker.halyard.config.model.v1.canary.AbstractCanaryAccount)7 AbstractCanaryServiceIntegration (com.netflix.spinnaker.halyard.config.model.v1.canary.AbstractCanaryServiceIntegration)4 OperationHandler (com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)2 GoogleCanaryAccount (com.netflix.spinnaker.halyard.config.model.v1.canary.google.GoogleCanaryAccount)2 ConfigProblemBuilder (com.netflix.spinnaker.halyard.config.problem.v1.ConfigProblemBuilder)2 UpdateRequestBuilder (com.netflix.spinnaker.halyard.core.DaemonResponse.UpdateRequestBuilder)2 ProblemSet (com.netflix.spinnaker.halyard.core.problem.v1.ProblemSet)2 Path (java.nio.file.Path)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 Compute (com.google.api.services.compute.Compute)1 GoogleNamedAccountCredentials (com.netflix.spinnaker.clouddriver.google.security.GoogleNamedAccountCredentials)1 ConfigNotFoundException (com.netflix.spinnaker.halyard.config.error.v1.ConfigNotFoundException)1 IllegalConfigException (com.netflix.spinnaker.halyard.config.error.v1.IllegalConfigException)1 Canary (com.netflix.spinnaker.halyard.config.model.v1.canary.Canary)1 AwsCanaryAccount (com.netflix.spinnaker.halyard.config.model.v1.canary.aws.AwsCanaryAccount)1 AwsCanaryServiceIntegration (com.netflix.spinnaker.halyard.config.model.v1.canary.aws.AwsCanaryServiceIntegration)1 DatadogCanaryAccount (com.netflix.spinnaker.halyard.config.model.v1.canary.datadog.DatadogCanaryAccount)1 GoogleCanaryServiceIntegration (com.netflix.spinnaker.halyard.config.model.v1.canary.google.GoogleCanaryServiceIntegration)1 PrometheusCanaryAccount (com.netflix.spinnaker.halyard.config.model.v1.canary.prometheus.PrometheusCanaryAccount)1 HalException (com.netflix.spinnaker.halyard.core.error.v1.HalException)1