com.ecwid.consul.v1.NodeMetaParameters Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of consul-api Show documentation
Show all versions of consul-api Show documentation
Java client for Consul HTTP API (http://consul.io)
The newest version!
package com.ecwid.consul.v1;
import com.ecwid.consul.UrlParameters;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class NodeMetaParameters implements UrlParameters {
private final Map nodeMeta;
public NodeMetaParameters(Map nodeMeta) {
this.nodeMeta = nodeMeta;
}
@Override
public List toUrlParameters() {
List params = new ArrayList<>();
if (nodeMeta != null) {
String key = "node-meta";
for (Map.Entry entry : nodeMeta.entrySet()) {
String value = entry.getKey() + ":" + entry.getValue();
params.add(key + "=" + value);
}
}
return params;
}
}