Search in sources :

Example 11 with OperationHandler

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

the class AbstractEditCanaryAccountCommand method executeThis.

@Override
protected void executeThis() {
    String accountName = getAccountName();
    String serviceIntegration = getServiceIntegration();
    String currentDeployment = getCurrentDeployment();
    // Disable validation here, since we don't want an illegal config to prevent us from fixing it.
    AbstractCanaryAccount account = new OperationHandler<AbstractCanaryAccount>().setFailureMesssage("Failed to get canary account " + accountName + " for service integration " + serviceIntegration + ".").setOperation(Daemon.getCanaryAccount(currentDeployment, serviceIntegration.toLowerCase(), accountName, false)).get();
    int originaHash = account.hashCode();
    account = editAccount((T) account);
    if (originaHash == account.hashCode()) {
        AnsiUi.failure("No changes supplied.");
        return;
    }
    new OperationHandler<Void>().setFailureMesssage("Failed to edit canary account " + accountName + " for service integration " + serviceIntegration + ".").setSuccessMessage("Successfully edited canary account " + accountName + " for service integration " + serviceIntegration + ".").setOperation(Daemon.setCanaryAccount(currentDeployment, serviceIntegration.toLowerCase(), accountName, !noValidate, account)).get();
}
Also used : AbstractCanaryAccount(com.netflix.spinnaker.halyard.config.model.v1.canary.AbstractCanaryAccount) OperationHandler(com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)

Example 12 with OperationHandler

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

the class AbstractEditProviderCommand method executeThis.

@Override
protected void executeThis() {
    String providerName = getProviderName();
    String currentDeployment = getCurrentDeployment();
    Provider provider = new OperationHandler<Provider>().setFailureMesssage("Failed to get provider " + providerName + ".").setOperation(Daemon.getProvider(currentDeployment, providerName, false)).get();
    int originalHash = provider.hashCode();
    provider = editProvider((P) provider);
    if (originalHash == provider.hashCode()) {
        AnsiUi.failure("No changes supplied.");
        return;
    }
    new OperationHandler<Void>().setFailureMesssage("Failed to edit provider " + providerName + ".").setSuccessMessage("Successfully edited provider " + providerName + ".").setOperation(Daemon.setProvider(currentDeployment, providerName, !noValidate, provider)).get();
}
Also used : Provider(com.netflix.spinnaker.halyard.config.model.v1.node.Provider) OperationHandler(com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)

Example 13 with OperationHandler

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

the class ListVersionCommand method executeThis.

@Override
protected void executeThis() {
    String version = new OperationHandler<String>().setOperation(Daemon.getVersion(getCurrentDeployment(), false)).setFailureMesssage("Failed to load your version of Spinnaker.").get();
    Versions versions = new OperationHandler<Versions>().setOperation(Daemon.getVersions()).setFailureMesssage("Failed to load available Spinnaker versions.").setSuccessMessage("You are on version \"" + version + "\", and the following are available:").setFormat(AnsiFormatUtils.Format.STRING).setUserFormatted(true).get();
}
Also used : Versions(com.netflix.spinnaker.halyard.core.registry.v1.Versions) OperationHandler(com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)

Example 14 with OperationHandler

use of com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler 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 15 with OperationHandler

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

the class ApiSecurityEditCommand method executeThis.

@Override
protected void executeThis() {
    String currentDeployment = getCurrentDeployment();
    ApiSecurity apiSecurity = new OperationHandler<ApiSecurity>().setOperation(Daemon.getApiSecurity(currentDeployment, false)).setFailureMesssage("Failed to load API security settings.").get();
    int originalHash = apiSecurity.hashCode();
    apiSecurity.setOverrideBaseUrl(isSet(overrideBaseUrl) ? overrideBaseUrl : apiSecurity.getOverrideBaseUrl());
    apiSecurity.setCorsAccessPattern(isSet(corsAccessPattern) ? corsAccessPattern : apiSecurity.getCorsAccessPattern());
    if (originalHash == apiSecurity.hashCode()) {
        AnsiUi.failure("No changes supplied.");
        return;
    }
    new OperationHandler<Void>().setOperation(Daemon.setApiSecurity(currentDeployment, !noValidate, apiSecurity)).setFailureMesssage("Failed to edit API security settings.").setFailureMesssage("Successfully updated API security settings.").get();
}
Also used : ApiSecurity(com.netflix.spinnaker.halyard.config.model.v1.security.ApiSecurity) 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