26#pragma warning disable API1001
66 authenticationContext,
95 return Accepted(
job.ToApi());
156#pragma warning disable CA1502
157#pragma warning disable CA1506
162 if (
model.SoftShutdown ==
true &&
model.SoftRestart ==
true)
170 .Select(
x =>
x.DreamDaemonSettings)
179 "Triggering port allocator for DD-I:{instanceId} because model port {modelPort} doesn't match DB port {dbPort}...",
234 var watchdog = instance.Watchdog;
235 if (!
String.IsNullOrWhiteSpace(
model.BroadcastMessage)
258#pragma warning restore CA1506
259#pragma warning restore CA1502
275 var watchdog = instance.Watchdog;
284 return Accepted(
job.ToApi());
301 var watchdog = instance.Watchdog;
310 return Accepted(
job.ToApi());
320#pragma warning disable CA1502
322#pragma warning restore CA1502
325 var dd = instance.Watchdog;
335 .Select(
x =>
x.DreamDaemonSettings!)
virtual ? long Id
The ID of the entity.
Metadata about a server instance.
DreamDaemonRights? DreamDaemonRights
The Rights.DreamDaemonRights of the InstancePermissionSet.
A request to update DreamDaemonSettings.
Represents an instance of BYOND's DreamDaemon game server. Create action starts the server....
Represents an error message returned by the server.
Represents a long running job on the server. Model is read-only, updates attempt to cancel the job.
Routes to a server actions.
const string DreamDaemon
The DreamDaemon controller.
const string Diagnostics
For accessing DD diagnostics.
ILogger< ApiController > Logger
The ILogger for the ApiController.
readonly IInstanceManager instanceManager
The IInstanceManager for the ComponentInterfacingController.
async ValueTask< IActionResult > WithComponentInstance(Func< IInstanceCore, ValueTask< IActionResult > > action, Models.Instance? instance=null)
Run a given action with the relevant IInstance.
ApiController for managing the DreamDaemonResponse.
ValueTask< IActionResult > Read(CancellationToken cancellationToken)
Get the watchdog status.
ValueTask< IActionResult > Restart(CancellationToken cancellationToken)
Creates a JobResponse to restart the Watchdog. It will not start if it wasn't already running.
readonly IPortAllocator portAllocator
The IPortAllocator for the DreamDaemonController.
ValueTask< IActionResult > Create(CancellationToken cancellationToken)
Launches the watchdog.
ValueTask< IActionResult > ReadImpl(DreamDaemonSettings? settings, bool knownForcedReboot, CancellationToken cancellationToken)
Implementation of Read(CancellationToken).
DreamDaemonController(IDatabaseContext databaseContext, IAuthenticationContext authenticationContext, ILogger< DreamDaemonController > logger, IInstanceManager instanceManager, IJobManager jobManager, IPortAllocator portAllocator, IApiHeadersProvider apiHeaders)
Initializes a new instance of the DreamDaemonController class.
ValueTask< IActionResult > CreateDump(CancellationToken cancellationToken)
Creates a JobResponse to generate a DreamDaemon process dump.
readonly IJobManager jobManager
The IJobManager for the DreamDaemonController.
async ValueTask< IActionResult > Update([FromBody] DreamDaemonRequest model, CancellationToken cancellationToken)
Update watchdog settings to be applied at next server reboot.
ValueTask< IActionResult > Delete(CancellationToken cancellationToken)
Stops the Watchdog if it's running.
ComponentInterfacingController for operations that require an instance.
Backend abstract implementation of IDatabaseContext.
DbSet< Instance > Instances
The Instances in the DatabaseContext.
Task Save(CancellationToken cancellationToken)
Saves changes made to the IDatabaseContext.A Task representing the running operation.
static Job Create(JobCode code, User? startedBy, Api.Models.Instance instance)
Creates a new job for registering in the Jobs.IJobService.
User User
The authenticated user.
ulong GetRight(RightsType rightsType)
Get the value of a given rightsType .The value of rightsType . Note that if InstancePermissionSet is ...
Manages the runtime of Jobs.
ValueTask RegisterOperation(Job job, JobEntrypoint operation, CancellationToken cancellationToken)
Registers a given Job and begins running it.
For creating and accessing authentication contexts.
Gets unassigned ports for use by TGS.
ValueTask< ushort?> GetAvailablePort(ushort basePort, bool checkOne, CancellationToken cancellationToken)
Gets a port not currently in use by TGS.
ErrorCode
Types of Response.ErrorMessageResponses that the API may return.
JobCode
The different types of Response.JobResponse.
WatchdogStatus
The current status of the watchdog.
@ List
User may list files if the Models.Instance allows it.
RightsType
The type of rights a model uses.
DreamDaemonRights
Rights for managing DreamDaemon.
RebootState
Represents the action to take when /world/Reboot() is called.