package io.vertx.ext.consul.impl;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.consul.KeyValue;
import java.util.Base64;
class KVParser {
private static final String KEY_KEY = "Key";
private static final String VALUE_KEY = "Value";
private static final String SESSION_KEY = "Session";
private static final String FLAGS_KEY = "Flags";
private static final String CREATE_KEY = "CreateIndex";
private static final String MODIFY_KEY = "ModifyIndex";
private static final String LOCK_KEY = "LockIndex";
static KeyValue parse(JsonObject json) {
return new KeyValue()
.setKey(json.getString(KEY_KEY))
.setValue(Utils.decode64(json.getString(VALUE_KEY)))
.setSession(json.getString(SESSION_KEY))
.setFlags(json.getLong(FLAGS_KEY, 0L))
.setCreateIndex(json.getLong(CREATE_KEY, 0L))
.setModifyIndex(json.getLong(MODIFY_KEY, 0L))
.setLockIndex(json.getLong(LOCK_KEY, 0L));
}
}