Search in sources :

Example 6 with Subscription

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

the class AbstractListSubscriptionsCommand method executeThis.

@Override
protected void executeThis() {
    Pubsub pubsub = getPubsub();
    List<Subscription> subscriptions = pubsub.getSubscriptions();
    if (subscriptions.isEmpty()) {
        AnsiUi.success("No configured subscriptions for " + getPubsubName() + ".");
    } else {
        AnsiUi.success("Subscriptions for " + getPubsubName() + ":");
        subscriptions.forEach(subscription -> AnsiUi.listItem(subscription.getName()));
    }
}
Also used : Pubsub(com.netflix.spinnaker.halyard.config.model.v1.node.Pubsub) Subscription(com.netflix.spinnaker.halyard.config.model.v1.node.Subscription)

Example 7 with Subscription

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

the class SubscriptionService method deleteSubscription.

public void deleteSubscription(String deploymentName, String pubsubName, String subscriptionName) {
    Pubsub pubsub = pubsubService.getPubsub(deploymentName, pubsubName);
    boolean removed = pubsub.getSubscriptions().removeIf(subscription -> ((Subscription) subscription).getName().equals(subscriptionName));
    if (!removed) {
        throw new HalException(new ConfigProblemBuilder(Severity.FATAL, "Subscription \"" + subscriptionName + "\" wasn't found").build());
    }
}
Also used : Pubsub(com.netflix.spinnaker.halyard.config.model.v1.node.Pubsub) ConfigProblemBuilder(com.netflix.spinnaker.halyard.config.problem.v1.ConfigProblemBuilder) HalException(com.netflix.spinnaker.halyard.core.error.v1.HalException) Subscription(com.netflix.spinnaker.halyard.config.model.v1.node.Subscription)

Example 8 with Subscription

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

the class SubscriptionService method addSubscription.

public void addSubscription(String deploymentName, String pubsubName, Subscription newSubscription) {
    Pubsub pubsub = pubsubService.getPubsub(deploymentName, pubsubName);
    pubsub.getSubscriptions().add(newSubscription);
}
Also used : Pubsub(com.netflix.spinnaker.halyard.config.model.v1.node.Pubsub)

Aggregations

Subscription (com.netflix.spinnaker.halyard.config.model.v1.node.Subscription)7 Pubsub (com.netflix.spinnaker.halyard.config.model.v1.node.Pubsub)3 OperationHandler (com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)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 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ConfigNotFoundException (com.netflix.spinnaker.halyard.config.error.v1.ConfigNotFoundException)1 NodeFilter (com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter)1 HalException (com.netflix.spinnaker.halyard.core.error.v1.HalException)1