tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
DreamDaemonClient.cs
Go to the documentation of this file.
1using System;
2using System.Threading;
3using System.Threading.Tasks;
4
9
11{
14 {
19
24
31 {
32 this.apiClient = apiClient ?? throw new ArgumentNullException(nameof(apiClient));
33 this.instance = instance ?? throw new ArgumentNullException(nameof(instance));
34 }
35
37 public ValueTask Shutdown(CancellationToken cancellationToken) => apiClient.Delete(Routes.DreamDaemon, instance.Id!.Value, cancellationToken);
38
40 public ValueTask<JobResponse> Start(CancellationToken cancellationToken) => apiClient.Create<JobResponse>(Routes.DreamDaemon, instance.Id!.Value, cancellationToken);
41
43 public ValueTask<JobResponse> Restart(CancellationToken cancellationToken) => apiClient.Patch<JobResponse>(Routes.DreamDaemon, instance.Id!.Value, cancellationToken);
44
46 public ValueTask<DreamDaemonResponse> Read(CancellationToken cancellationToken) => apiClient.Read<DreamDaemonResponse>(
48 instance.Id!.Value,
49 cancellationToken);
50
52 public ValueTask<DreamDaemonResponse> Update(DreamDaemonRequest dreamDaemon, CancellationToken cancellationToken) => apiClient.Update<DreamDaemonRequest, DreamDaemonResponse>(Routes.DreamDaemon, dreamDaemon ?? throw new ArgumentNullException(nameof(dreamDaemon)), instance.Id!.Value, cancellationToken);
53
55 public ValueTask<JobResponse> CreateDump(CancellationToken cancellationToken) => apiClient.Patch<JobResponse>(Routes.Diagnostics, instance.Id!.Value, cancellationToken);
56 }
57}
virtual ? long Id
The ID of the entity.
Definition EntityId.cs:13
Metadata about a server instance.
Definition Instance.cs:9
Represents an instance of BYOND's DreamDaemon game server. Create action starts the server....
Represents a long running job on the server. Model is read-only, updates attempt to cancel the job.
Definition JobResponse.cs:7
Routes to a server actions.
Definition Routes.cs:9
const string DreamDaemon
The DreamDaemon controller.
Definition Routes.cs:63
const string Diagnostics
For accessing DD diagnostics.
Definition Routes.cs:68
readonly IApiClient apiClient
The IApiClient for the DreamDaemonClient.
DreamDaemonClient(IApiClient apiClient, Instance instance)
Initializes a new instance of the DreamDaemonClient class.
ValueTask< JobResponse > Start(CancellationToken cancellationToken)
Start DreamDaemonResponse.A Task<TResult> resulting in the JobResponse of the running operation.
ValueTask Shutdown(CancellationToken cancellationToken)
Shutdown DreamDaemonResponse.A ValueTask<TResult> resulting in the DreamDaemonResponse information.
ValueTask< JobResponse > Restart(CancellationToken cancellationToken)
Restart DreamDaemonResponse.A ValueTask<TResult> resulting in the JobResponse of the running operatio...
ValueTask< DreamDaemonResponse > Update(DreamDaemonRequest dreamDaemon, CancellationToken cancellationToken)
Update DreamDaemonResponse. This may trigger a Api.Models.Internal.DreamDaemonApiBase....
ValueTask< DreamDaemonResponse > Read(CancellationToken cancellationToken)
Get the DreamDaemonResponse represented by the IDreamDaemonClient.A ValueTask<TResult> resulting in t...
ValueTask< JobResponse > CreateDump(CancellationToken cancellationToken)
Start a job to create a process dump of the active DreamDaemon executable.A ValueTask<TResult> result...
readonly Instance instance
The Instance for the DreamDaemonClient.
Web interface for the API.
Definition IApiClient.cs:17
ValueTask Patch(string route, CancellationToken cancellationToken)
Run an HTTP PATCH request.
ValueTask Delete(string route, CancellationToken cancellationToken)
Run an HTTP DELETE request.