Skip to content

Instance Operation Related Models

class CRLFType(IntEnum)

Line break types.

Enumerated ValueEnumerated Value
LF0
CR1
CRLF2

class Status(IntEnum)

Instance status.

Enumerated ValueEnumerated ValueDescription
BUSY-1Under maintenance
STOP0Not running
STOPPING1Stopping
STARTING2Starting
RUNNING3Running

class batchOperationDetail(TypedDict)

Batch operation instance information.

Field NameTypeDescription
uuidstrInstance UUID
daemonIdstrNode UUID

class TerminalOption(BaseModel)

Terminal options.

Field NameTypeDescription
haveColorboolEnable frontend color rendering
ptyboolUse pseudo-terminal (PTY)
ptyWindowColintPTY window column count
ptyWindowRowintPTY window row count

class EventTask(BaseModel)

Event tasks.

Field NameTypeDescription
autoStartboolAutomatically start
autoRestartboolAutomatically restart
ignoreboolIgnore this task

class PingConfig(BaseModel)

Server ping configuration (deprecated).

Field NameTypeDescription
ipstrServer IP address
portintServer port
typeintPing type (0: UDP, 1: TCP)

class InstanceConfig(BaseModel)

Instance configuration information.

Field NameTypeDescription
nicknamestrInstance name
startCommandstrStart command
stopCommandstrStop command
cwdstrWorking directory
iestrInput encoding
oestrOutput encoding
createDatetimeintCreation time (Unix timestamp)
lastDatetimeintLast modification time (Unix timestamp)
typestrInstance type (e.g., universal, minecraft)
taglist[str]Instance tags
endTimeint | NoneInstance expiration time
fileCodestrFile encoding
processTypestrProcess type (e.g., docker, general)
updateCommandstrUpdate command
actionCommandListlist[str]List of executable commands for the instance
crlfCRLFTypeLine break type
dockerDockerConfigDocker-related configuration
enableRconboolEnable RCON remote control
rconPasswordstrRCON connection password
rconPortintRCON port
rconIpstrRCON IP address
terminalOptionTerminalOptionTerminal option configuration
eventTaskEventTaskEvent task configuration
pingConfigPingConfigServer ping monitoring configuration (deprecated)
runAsstrSystem user to run the instance, empty to use the panel's system user

class InstanceProcessInfo(BaseModel)

Process information.

Field NameTypeDescription
cpuintCPU usage percentage (%)
memoryintProcess memory usage (KB)
ppidintParent process ID
pidintProcess ID
ctimeintProcess creation time (Unix timestamp)
elapsedintProcess runtime (seconds)
timestampintTimestamp

Instance Operation Related Models

class InstanceInfo(BaseModel)

Instance runtime status information (these options are no longer supported for setting in newer versions but are still returned in the API).

Field NameTypeDescription
currentPlayersintCurrent number of players
fileLockintFile lock status (0: Unlocked)
maxPlayersintMaximum allowed players (-1 indicates unknown)
openFrpStatusboolEnable FRP remote service
playersChartlist[dict]Player count change chart data
versionstrServer version

class InstanceDetail(BaseModel)

Instance detailed information.

Field NameTypeDescription
configInstanceConfigInstance configuration information
infoInstanceInfoInstance runtime status information
daemonIdstrNode UUID
instanceUuidstrInstance UUID
processInfoInstanceProcessInfoInstance process information
startedintNumber of times the instance has been started
statusStatusInstance status

method start(self)

Start the instance.

Return

UUID of the started instance.

method stop(self)

Stop the instance.

Return

UUID of the stopped instance.

method restart(self)

Restart the instance.

Return

UUID of the restarted instance.

method kill(self)

Forcefully shut down the instance.

Return

UUID of the instance that was force-closed.

method delete(self, deleteFile: bool = False)

Delete the instance.

Parameters

  • deleteFile: Whether to delete associated files.

Return

UUID of the deleted instance.

method update(self)

Upgrade the instance.

Return

Returns True if the operation is successful.

method updateConfig(self, config: dict[str, Any])

Update the instance configuration.

Parameters

  • config: New instance configuration provided as a dictionary. Missing values are filled with the original instance configuration.

Return

Returns the UUID of the updated instance upon success.

method reinstall(self, targetUrl: str, title: str = "", description: str = "")

Reinstall the instance.

Parameters

  • targetUrl: Target URL of the reinstall file.
  • title: Title of the reinstall file.
  • description: Description of the reinstall file, defaults to an empty string.

Return

Returns True if the operation is successful.

method command(self, command: str)

Send a command to the instance.

Parameters

  • command: Command to be sent.

Return

UUID of the instance that was operated on.

method get_output(self, size: int | None = None)

Get the instance output.

Parameters

  • size: Size of the output to retrieve.

Return

  • str: Output result.

method files(self, target: str = "", page: int = 0, page_size: int = 100, file_name: str = "")

Get the list of instance files.

Parameters

  • target: Target path for file filtering, defaults to an empty string, indicating no filtering by path.
  • page: Page number for pagination.
  • page_size: Number of files per page.
  • file_name: String to filter files or folders whose names contain the specified string.

Return

  • FileList: List of files.

class InstanceCreateResult(BaseModel)

Instance creation result.

Field NameTypeDescription
instanceUuidstrInstance UUID
configInstanceConfigInstance configuration

class InstanceSearchList(BaseModel)

Instance search list.

Field NameTypeDescription
pageSizeintNumber of instances per page
maxPageintMaximum number of pages
datalist[InstanceDetail]List of instance details
daemonIdstrNode UUID

class UserInstancesList(BaseModel)

User instance list.

Field NameTypeDescription
instanceUuidstrInstance UUID
daemonIdstrNode UUID

Released under the MIT License.