mn.foreman.api.endpoints.autominer.AutominerImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-api Show documentation
Show all versions of java-api Show documentation
A library for interacting with the Foreman API.
package mn.foreman.api.endpoints.autominer;
import mn.foreman.api.JsonUtils;
import mn.foreman.api.WebUtil;
import mn.foreman.api.model.ApiType;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.Collections;
import java.util.Map;
/** A {@link Autominer} implementation. */
public class AutominerImpl
implements Autominer {
/** The mapper. */
private final ObjectMapper objectMapper;
/** The web utilities. */
private final WebUtil webUtil;
/**
* Constructor.
*
* @param objectMapper The mapper.
* @param webUtil The web utilities.
*/
public AutominerImpl(
final ObjectMapper objectMapper,
final WebUtil webUtil) {
this.objectMapper = objectMapper;
this.webUtil = webUtil;
}
@Override
public Map mappings() {
return this.webUtil.get(
"/api/autominer")
.flatMap(
s -> JsonUtils.fromJson(
s,
this.objectMapper,
new TypeReference