Search in sources :

Example 16 with OperationHandler

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

the class AbstractAddSubscriptionCommand method executeThis.

@Override
protected void executeThis() {
    String subscriptionName = getSubscriptionName();
    Subscription subscription = buildSubscription(subscriptionName);
    String pubsubName = getPubsubName();
    String currentDeployment = getCurrentDeployment();
    new OperationHandler<Void>().setFailureMesssage("Failed to add subscription " + subscriptionName + " for pubsub " + pubsubName + ".").setSuccessMessage("Successfully added subscription " + subscriptionName + " for pubsub " + pubsubName + ".").setOperation(Daemon.addSubscription(currentDeployment, pubsubName, !noValidate, subscription)).get();
}
Also used : Subscription(com.netflix.spinnaker.halyard.config.model.v1.node.Subscription) OperationHandler(com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)

Example 17 with OperationHandler

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

the class UiSecurityEditCommand method executeThis.

@Override
protected void executeThis() {
    String currentDeployment = getCurrentDeployment();
    UiSecurity uiSecurity = new OperationHandler<UiSecurity>().setOperation(Daemon.getUiSecurity(currentDeployment, false)).setFailureMesssage("Failed to load UI security settings.").get();
    int originalHash = uiSecurity.hashCode();
    uiSecurity.setOverrideBaseUrl(isSet(overrideBaseUrl) ? overrideBaseUrl : uiSecurity.getOverrideBaseUrl());
    if (originalHash == uiSecurity.hashCode()) {
        AnsiUi.failure("No changes supplied.");
        return;
    }
    new OperationHandler<Void>().setOperation(Daemon.setUiSecurity(currentDeployment, !noValidate, uiSecurity)).setFailureMesssage("Failed to edit UI security settings.").setSuccessMessage("Successfully updated UI security settings.").get();
}
Also used : UiSecurity(com.netflix.spinnaker.halyard.config.model.v1.security.UiSecurity) OperationHandler(com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)

Example 18 with OperationHandler

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

the class AbstractEditRoleProviderCommand method executeThis.

@Override
protected void executeThis() {
    String currentDeployment = getCurrentDeployment();
    String roleProviderName = getRoleProviderType() + "";
    // Disable validation here, since we don't want an illegal config to prevent us from fixing it.
    RoleProvider roleProvider = new OperationHandler<RoleProvider>().setOperation(Daemon.getRoleProvider(currentDeployment, roleProviderName, false)).setFailureMesssage("Failed to get " + roleProviderName + " method.").get();
    new OperationHandler<Void>().setOperation(Daemon.setRoleProvider(currentDeployment, roleProviderName, !noValidate, editRoleProvider((T) roleProvider))).setFailureMesssage("Failed to edit " + roleProviderName + " method.").setSuccessMessage("Successfully edited " + roleProviderName + " method.").get();
}
Also used : RoleProvider(com.netflix.spinnaker.halyard.config.model.v1.security.RoleProvider) OperationHandler(com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)

Example 19 with OperationHandler

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

the class SpringSslEditCommand method executeThis.

@Override
protected void executeThis() {
    String currentDeployment = getCurrentDeployment();
    SpringSsl springSsl = new OperationHandler<SpringSsl>().setOperation(Daemon.getSpringSsl(currentDeployment, false)).setFailureMesssage("Failed to load SSL settings.").get();
    int originalHash = springSsl.hashCode();
    springSsl.setKeyAlias(isSet(keyAlias) ? keyAlias : springSsl.getKeyAlias());
    springSsl.setKeyStore(isSet(keyStore) ? keyStore : springSsl.getKeyStore());
    springSsl.setKeyStoreType(isSet(keyStoreType) ? keyStoreType : springSsl.getKeyStoreType());
    springSsl.setKeyStorePassword(isSet(keyStorePassword) ? keyStorePassword : springSsl.getKeyStorePassword());
    springSsl.setTrustStore(isSet(trustStore) ? trustStore : springSsl.getTrustStore());
    springSsl.setTrustStoreType(isSet(trustStoreType) ? trustStoreType : springSsl.getTrustStoreType());
    springSsl.setTrustStorePassword(isSet(trustStorePassword) ? trustStorePassword : springSsl.getTrustStorePassword());
    springSsl.setClientAuth(isSet(clientAuth) ? clientAuth : springSsl.getClientAuth());
    if (originalHash == springSsl.hashCode()) {
        AnsiUi.failure("No changes supplied.");
        return;
    }
    new OperationHandler<Void>().setOperation(Daemon.setSpringSsl(currentDeployment, !noValidate, springSsl)).setFailureMesssage("Failed to edit SSL settings.").setFailureMesssage("Successfully updated SSL settings.").get();
}
Also used : SpringSsl(com.netflix.spinnaker.halyard.config.model.v1.security.SpringSsl) OperationHandler(com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)

Example 20 with OperationHandler

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

the class AbstractEditSubscriptionCommand method executeThis.

@Override
protected void executeThis() {
    String subscriptionName = getSubscriptionName();
    String pubsubName = getPubsubName();
    String currentDeployment = getCurrentDeployment();
    // Disable validation here, since we don't want an illegal config to prevent us from fixing it.
    Subscription subscription = new OperationHandler<Subscription>().setFailureMesssage("Failed to get subscription " + subscriptionName + " for pubsub " + pubsubName + ".").setOperation(Daemon.getSubscription(currentDeployment, pubsubName, subscriptionName, false)).get();
    int originaHash = subscription.hashCode();
    subscription = editSubscription((T) subscription);
    if (originaHash == subscription.hashCode()) {
        AnsiUi.failure("No changes supplied.");
        return;
    }
    new OperationHandler<Void>().setFailureMesssage("Failed to edit subscription " + subscriptionName + " for pubsub " + pubsubName + ".").setSuccessMessage("Successfully edited subscription " + subscriptionName + " for pubsub " + pubsubName + ".").setOperation(Daemon.setSubscription(currentDeployment, pubsubName, subscriptionName, !noValidate, subscription)).get();
}
Also used : Subscription(com.netflix.spinnaker.halyard.config.model.v1.node.Subscription) 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