Search in sources :

Example 51 with Account

use of com.netflix.spinnaker.halyard.config.model.v1.node.Account 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 52 with Account

use of com.netflix.spinnaker.halyard.config.model.v1.node.Account 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 53 with Account

use of com.netflix.spinnaker.halyard.config.model.v1.node.Account 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 54 with Account

use of com.netflix.spinnaker.halyard.config.model.v1.node.Account in project halyard by spinnaker.

the class AbstractArtifactEditAccountCommand method executeThis.

@Override
protected void executeThis() {
    String accountName = getArtifactAccountName();
    String providerName = getArtifactProviderName();
    String currentDeployment = getCurrentDeployment();
    // Disable validation here, since we don't want an illegal config to prevent us from fixing it.
    ArtifactAccount account = new OperationHandler<ArtifactAccount>().setFailureMesssage("Failed to get account " + accountName + " for provider " + providerName + ".").setOperation(Daemon.getArtifactAccount(currentDeployment, providerName, accountName, false)).get();
    int originaHash = account.hashCode();
    account = editArtifactAccount((T) account);
    if (originaHash == account.hashCode()) {
        AnsiUi.failure("No changes supplied.");
        return;
    }
    new OperationHandler<Void>().setFailureMesssage("Failed to edit artifact account " + accountName + " for artifact provider " + providerName + ".").setSuccessMessage("Successfully edited artifact account " + accountName + " for artifact provider " + providerName + ".").setOperation(Daemon.setArtifactAccount(currentDeployment, providerName, accountName, !noValidate, account)).get();
}
Also used : ArtifactAccount(com.netflix.spinnaker.halyard.config.model.v1.node.ArtifactAccount) OperationHandler(com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)

Example 55 with Account

use of com.netflix.spinnaker.halyard.config.model.v1.node.Account in project halyard by spinnaker.

the class AbstractListArtifactAccountsCommand method executeThis.

@Override
protected void executeThis() {
    ArtifactProvider provider = getArtifactProvider();
    List<ArtifactAccount> accounts = provider.getAccounts();
    if (accounts.isEmpty()) {
        AnsiUi.success("No configured artifact accounts for " + getArtifactProviderName() + ".");
    } else {
        AnsiUi.success("Artifact accounts for " + getArtifactProviderName() + ":");
        accounts.forEach(account -> AnsiUi.listItem(account.getName()));
    }
}
Also used : ArtifactProvider(com.netflix.spinnaker.halyard.config.model.v1.node.ArtifactProvider) ArtifactAccount(com.netflix.spinnaker.halyard.config.model.v1.node.ArtifactAccount)

Aggregations

Account (com.netflix.spinnaker.halyard.config.model.v1.node.Account)19 List (java.util.List)13 Provider (com.netflix.spinnaker.halyard.config.model.v1.node.Provider)11 KubernetesAccount (com.netflix.spinnaker.halyard.config.model.v1.providers.kubernetes.KubernetesAccount)11 HalException (com.netflix.spinnaker.halyard.core.error.v1.HalException)11 Collectors (java.util.stream.Collectors)10 DeploymentConfiguration (com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration)9 ConfigProblemBuilder (com.netflix.spinnaker.halyard.config.problem.v1.ConfigProblemBuilder)8 ArrayList (java.util.ArrayList)8 AbstractCanaryAccount (com.netflix.spinnaker.halyard.config.model.v1.canary.AbstractCanaryAccount)7 Path (java.nio.file.Path)7 OperationHandler (com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)6 ArtifactAccount (com.netflix.spinnaker.halyard.config.model.v1.node.ArtifactAccount)6 DockerRegistryReference (com.netflix.spinnaker.halyard.config.model.v1.providers.containers.DockerRegistryReference)6 GoogleAccount (com.netflix.spinnaker.halyard.config.model.v1.providers.google.GoogleAccount)6 UpdateRequestBuilder (com.netflix.spinnaker.halyard.core.DaemonResponse.UpdateRequestBuilder)6 ServiceSettings (com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.ServiceSettings)6 IOException (java.io.IOException)5 Collections (java.util.Collections)5 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)5