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, } }
-
Field Summary
FieldsFields 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
ConstructorsConstructorDescriptionExecuteSystemCommandRequest
(String command, boolean runInBackground, int timeoutSeconds, Optional<String> username, Optional<String> password) ExecuteSystemCommandRequest
(UUID id, String command, boolean runInBackground, int timeoutSeconds, Optional<String> username, Optional<String> password) -
Method Summary
Modifier and TypeMethodDescriptionstatic ExecuteSystemCommandRequest
Parses a genericJsonrpcRequest
to aExecuteSystemCommandRequest
.Gets the request command.com.google.gson.JsonObject
Gets the paramsJsonObject
of theJsonrpcRequest
.Gets the request password.int
Gets the request timeout.Gets the request username.boolean
Gets the request isRunInBackground option.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:
-
-
Constructor Details
-
ExecuteSystemCommandRequest
-
ExecuteSystemCommandRequest
-
-
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
-
getCommand
Gets the request command.- Returns:
- the command
-
isRunInBackground
public boolean isRunInBackground()Gets the request isRunInBackground option.- Returns:
- the isRunInBackground option
-
getTimeoutSeconds
public int getTimeoutSeconds()Gets the request timeout.- Returns:
- the timeout in seconds
-
getUsername
Gets the request username.- Returns:
- the username
-
getPassword
Gets the request password.- Returns:
- the password
-