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

mn.foreman.api.endpoints.actions.Actions Maven / Gradle / Ivy

There is a newer version: 1.78.0
Show newest version
package mn.foreman.api.endpoints.actions;

import mn.foreman.api.endpoints.StatusSubmit;
import mn.foreman.api.model.Network;
import mn.foreman.api.model.Pool;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

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

/**
 * An {@link Actions} provides a handler for interacting with the
 * /api/actions Foreman API endpoint.
 */
public interface Actions {

    /**
     * Changes the network for the provided miner.
     *
     * @param minerId The miner ID.
     * @param network The new network configuration.
     *
     * @return The response, if present.
     */
    Optional changeNetwork(
            int minerId,
            Network network);

    /**
     * Changes the pools for the provided miner.
     *
     * @param minerId The miner ID.
     * @param pools   The new pools.
     *
     * @return The response, if present.
     */
    Optional changePools(
            int minerId,
            List pools);

    /**
     * Changes the power mode for the provided miner.
     *
     * @param minerId The miner ID.
     * @param mode    The power mode.
     *
     * @return The response, if present.
     */
    Optional changePowerMode(
            int minerId,
            PowerMode mode);

    /**
     * Gets the status of the provided command.
     *
     * @param command The command.
     *
     * @return The status, if present.
     */
    Optional status(
            int command);

    /** All of the known power modes. */
    enum PowerMode {

        /** Sleeping. */
        SLEEPING,

        /** Low power mode. */
        LOW,

        /** Normal power mode. */
        NORMAL,

        /** High power mode. */
        HIGH;
    }

    /** An action response. */
    @JsonIgnoreProperties(ignoreUnknown = true)
    class Response {

        /** The new command ID. */
        @JsonProperty("command")
        public int command;

        /** The status. */
        @JsonProperty("status")
        public StatusSubmit status;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy