Search in sources :

Example 1 with OperationHandler

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

the class EditFeaturesCommand method executeThis.

@Override
protected void executeThis() {
    String currentDeployment = getCurrentDeployment();
    Features features = new OperationHandler<Features>().setOperation(Daemon.getFeatures(currentDeployment, false)).setFailureMesssage("Failed to load features.").get();
    int originalHash = features.hashCode();
    features.setChaos(chaos != null ? chaos : features.isChaos());
    features.setJobs(jobs != null ? jobs : features.isJobs());
    features.setPipelineTemplates(pipelineTemplates != null ? pipelineTemplates : features.getPipelineTemplates());
    features.setArtifacts(artifacts != null ? artifacts : features.getArtifacts());
    features.setMineCanary(mineCanary != null ? mineCanary : features.getMineCanary());
    features.setInfrastructureStages(infrastructureStages != null ? infrastructureStages : features.getInfrastructureStages());
    if (originalHash == features.hashCode()) {
        AnsiUi.failure("No changes supplied.");
        return;
    }
    new OperationHandler<Void>().setOperation(Daemon.setFeatures(currentDeployment, !noValidate, features)).setSuccessMessage("Successfully updated features.").setFailureMesssage("Failed to edit features.").get();
}
Also used : Features(com.netflix.spinnaker.halyard.config.model.v1.node.Features) OperationHandler(com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)

Example 2 with OperationHandler

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

the class AbstractAddArtifactAccountCommand method executeThis.

@Override
protected void executeThis() {
    String accountName = getArtifactAccountName();
    ArtifactAccount account = buildArtifactAccount(accountName);
    String providerName = getArtifactProviderName();
    String currentDeployment = getCurrentDeployment();
    new OperationHandler<Void>().setFailureMesssage("Failed to add artifact account " + accountName + " for artifact provider " + providerName + ".").setSuccessMessage("Successfully added artifact account " + accountName + " for artifact provider " + providerName + ".").setOperation(Daemon.addArtifactAccount(currentDeployment, providerName, !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 3 with OperationHandler

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

the class AbstractAddMasterCommand method executeThis.

@Override
protected void executeThis() {
    String masterName = getMasterName();
    Master master = buildMaster(masterName);
    String ciName = getCiName();
    String currentDeployment = getCurrentDeployment();
    new OperationHandler<Void>().setOperation(Daemon.addMaster(currentDeployment, ciName, !noValidate, master)).setSuccessMessage("Added " + masterName + " for " + ciName + ".").setFailureMesssage("Failed to add " + masterName + " for " + ciName + ".").get();
}
Also used : Master(com.netflix.spinnaker.halyard.config.model.v1.node.Master) OperationHandler(com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)

Example 4 with OperationHandler

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

the class AbstractEditMasterCommand method executeThis.

@Override
protected void executeThis() {
    String masterName = getMasterName();
    String ciName = getCiName();
    String currentDeployment = getCurrentDeployment();
    // Disable validation here, since we don't want an illegal config to prevent us from fixing it.
    Master master = new OperationHandler<Master>().setOperation(Daemon.getMaster(currentDeployment, ciName, masterName, !noValidate)).setFailureMesssage("Failed to get " + masterName + " under " + ciName + ".").get();
    int originalHash = master.hashCode();
    master = editMaster((T) master);
    if (originalHash == master.hashCode()) {
        AnsiUi.failure("No changes supplied.");
        return;
    }
    new OperationHandler<Void>().setOperation(Daemon.setMaster(currentDeployment, ciName, masterName, !noValidate, master)).setSuccessMessage("Edited " + masterName + " for " + ciName + ".").setFailureMesssage("Failed to edit " + masterName + " for " + ciName + ".").get();
}
Also used : Master(com.netflix.spinnaker.halyard.config.model.v1.node.Master) OperationHandler(com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)

Example 5 with OperationHandler

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

the class AbstractEditMetricStoreCommand method executeThis.

@Override
protected void executeThis() {
    String currentDeployment = getCurrentDeployment();
    String metricStoreType = getMetricStoreType().getId();
    // Disable validation here, since we don't want an illegal config to prevent us from fixing it.
    MetricStore metricStore = new OperationHandler<MetricStore>().setOperation(Daemon.getMetricStore(currentDeployment, metricStoreType, false)).setFailureMesssage("Failed to get " + metricStoreType + " method.").get();
    int originalHash = metricStore.hashCode();
    metricStore = editMetricStore((T) metricStore);
    if (originalHash == metricStore.hashCode()) {
        AnsiUi.failure("No changes supplied.");
        return;
    }
    new OperationHandler<Void>().setOperation(Daemon.setMetricStore(currentDeployment, metricStoreType, !noValidate, metricStore)).setFailureMesssage("Failed to edit " + metricStoreType + " method.").setSuccessMessage("Successfully edited " + metricStoreType + " method.").get();
}
Also used : MetricStore(com.netflix.spinnaker.halyard.config.model.v1.node.MetricStore) 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