All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.kiwiproject.consul.option.QueryParameterOptions Maven / Gradle / Ivy

package org.kiwiproject.consul.option;

import static org.kiwiproject.consul.option.Options.optionallyAdd;

import org.immutables.value.Value;

import java.util.LinkedList;
import java.util.List;
import java.util.Optional;

/**
 * Container for common query options used by the Consul API.
 */
@Value.Immutable
@Value.Style(jakarta = true)
public abstract class QueryParameterOptions implements ParamAdder {

    public static final QueryParameterOptions BLANK = ImmutableQueryParameterOptions.builder().build();

    public abstract Optional getReplaceExistingChecks();
    public abstract Optional getPrune();

    @Override
    public List toQueryParameters() {
        List result = new LinkedList<>();

        optionallyAdd(result, "replace-existing-checks", getReplaceExistingChecks());
        optionallyAdd(result, "prune", getPrune());

        return result;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy