Class ExecuteSystemCommandRequest
java.lang.Object
io.openems.common.jsonrpc.base.JsonrpcMessage
io.openems.common.jsonrpc.base.AbstractJsonrpcRequest
io.openems.common.jsonrpc.base.JsonrpcRequest
io.openems.edge.core.host.jsonrpc.ExecuteSystemCommandRequest
Represents a JSON-RPC Request to execute a system command on OpenEMS Edge.
{ "jsonrpc": "2.0", "id": "UUID", "method": "executeSystemCommand", "params": { "command": string, "runInBackground"?: boolean = false, // run the command in background (true) or in foreground (false) "timeoutSeconds"?: number = 5, // interrupt the command after ... seconds "username"?: string, "password"?: string, } }
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final record
Holds common parameters for aExecuteSystemCommandRequest.SystemCommand
. -
Field Summary
Fields inherited from class io.openems.common.jsonrpc.base.JsonrpcRequest
id, NO_TIMEOUT, timeoutOpt
Fields inherited from class io.openems.common.jsonrpc.base.JsonrpcMessage
JSONRPC_VERSION
-
Constructor Summary
ConstructorDescriptionExecuteSystemCommandRequest
(String command, boolean runInBackground, int timeoutSeconds, Optional<String> username, Optional<String> password) ExecuteSystemCommandRequest
(UUID id, ExecuteSystemCommandRequest.SystemCommand systemCommand) -
Method Summary
Modifier and TypeMethodDescriptionstatic ExecuteSystemCommandRequest
Parses a genericJsonrpcRequest
to aExecuteSystemCommandRequest
.com.google.gson.JsonObject
Gets the paramsJsonObject
of theJsonrpcRequest
.static ExecuteSystemCommandRequest
Factory without Username + Password; run in background without timeout.static ExecuteSystemCommandRequest
withoutAuthentication
(String command, boolean runInBackground, int timeoutSeconds) Factory without Username + Password.Methods inherited from class io.openems.common.jsonrpc.base.JsonrpcRequest
getId, getTimeout, toJsonObject
Methods inherited from class io.openems.common.jsonrpc.base.AbstractJsonrpcRequest
getFullyQualifiedMethod, getMethod
Methods inherited from class io.openems.common.jsonrpc.base.JsonrpcMessage
from, from, toString
-
Field Details
-
METHOD
- See Also:
-
DEFAULT_RUN_IN_BACKGROUND
public static final boolean DEFAULT_RUN_IN_BACKGROUND- See Also:
-
DEFAULT_TIMEOUT_SECONDS
public static final int DEFAULT_TIMEOUT_SECONDS- See Also:
-
systemCommand
-
-
Constructor Details
-
ExecuteSystemCommandRequest
-
ExecuteSystemCommandRequest
public ExecuteSystemCommandRequest(UUID id, ExecuteSystemCommandRequest.SystemCommand systemCommand)
-
-
Method Details
-
from
public static ExecuteSystemCommandRequest from(JsonrpcRequest r) throws OpenemsError.OpenemsNamedException Parses a genericJsonrpcRequest
to aExecuteSystemCommandRequest
.- Parameters:
r
- theJsonrpcRequest
- Returns:
- the
ExecuteSystemCommandRequest
- Throws:
OpenemsError.OpenemsNamedException
- on error
-
runInBackgroundWithoutAuthentication
Factory without Username + Password; run in background without timeout.- Parameters:
command
- the command- Returns:
- the
ExecuteSystemCommandRequest
-
withoutAuthentication
public static ExecuteSystemCommandRequest withoutAuthentication(String command, boolean runInBackground, int timeoutSeconds) Factory without Username + Password.- Parameters:
command
- the commandrunInBackground
- run the command in background (true) or in foreground (false)timeoutSeconds
- interrupt the command after ... seconds- Returns:
- the
ExecuteSystemCommandRequest
-
getParams
public com.google.gson.JsonObject getParams()Description copied from class:AbstractJsonrpcRequest
Gets the paramsJsonObject
of theJsonrpcRequest
.- Specified by:
getParams
in classAbstractJsonrpcRequest
- Returns:
- the params as
JsonObject
-