
com.orbitz.consul.option.DeleteOptions Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of consul-client Show documentation
Show all versions of consul-client Show documentation
Java client for the Consul HTTP API.
The newest version!
package com.orbitz.consul.option;
import java.util.Optional;
import org.immutables.value.Value;
import java.util.HashMap;
import java.util.Map;
import static com.orbitz.consul.option.Options.optionallyAdd;
@Value.Immutable
public abstract class DeleteOptions implements ParamAdder {
public static final DeleteOptions BLANK = ImmutableDeleteOptions.builder().build();
public static final DeleteOptions RECURSE = ImmutableDeleteOptions.builder().recurse(true).build();
public abstract Optional getCas();
public abstract Optional getRecurse();
public abstract Optional getDatacenter();
@Value.Derived
public boolean isRecurse() {
return getRecurse().isPresent();
}
@Override
public Map toQuery() {
final Map result = new HashMap<>();
if (isRecurse()) {
result.put("recurse", "");
}
optionallyAdd(result, "cas", getCas());
optionallyAdd(result, "dc", getDatacenter());
return result;
}
}