tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
InstanceManagerClient.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.Threading;
4using System.Threading.Tasks;
5
11
13{
16 {
22 : base(apiClient)
23 {
24 }
25
28
30 public ValueTask Detach(EntityId instance, CancellationToken cancellationToken) => ApiClient.Delete(Routes.SetID(Routes.InstanceManager, instance?.Id ?? throw new ArgumentNullException(nameof(instance))), cancellationToken);
31
35
38
41
44
47 {
48 if (instance == null)
49 throw new ArgumentNullException(nameof(instance));
50
51 if (!instance.Id.HasValue)
52 throw new ArgumentException("Instance missing Id!", nameof(instance));
53
54 return new InstanceClient(
56 instance);
57 }
58 }
59}
Common base of entities with IDs.
Definition EntityId.cs:7
virtual ? long Id
The ID of the entity.
Definition EntityId.cs:13
Metadata about a server instance.
Definition Instance.cs:9
Routes to a server actions.
Definition Routes.cs:9
static string SetID(string route, long id)
Apply an id postfix to a route .
const string InstanceManager
The Models.Instance controller.
Definition Routes.cs:48
static string ListRoute(string route)
Get the /List postfix for a route .
ValueTask Delete(string route, CancellationToken cancellationToken)
Run an HTTP DELETE request.A ValueTask representing the running operation.
ValueTask Patch(string route, CancellationToken cancellationToken)
Run an HTTP PATCH request.A ValueTask representing the running operation.
ValueTask< InstanceResponse > CreateOrAttach(InstanceCreateRequest instance, CancellationToken cancellationToken)
Create or attach an instance .A ValueTask<TResult> resulting in the created or attached Instance.
ValueTask GrantPermissions(EntityId instance, CancellationToken cancellationToken)
Gives the user full permissions on an instance .A ValueTask representing the running operation.
ValueTask< InstanceResponse > Update(InstanceUpdateRequest instance, CancellationToken cancellationToken)
Relocates, renamed, and/or on/offlines an instance .A ValueTask<TResult> resulting in the updated Ins...
ValueTask< InstanceResponse > GetId(EntityId instance, CancellationToken cancellationToken)
Get a specific instance .A ValueTask<TResult> resulting in the Instance.
InstanceManagerClient(IApiClient apiClient)
Initializes a new instance of the InstanceManagerClient class.
ValueTask Detach(EntityId instance, CancellationToken cancellationToken)
Deletes an instance .A ValueTask representing the running operation.
ValueTask< List< InstanceResponse > > List(PaginationSettings? paginationSettings, CancellationToken cancellationToken)
Get all IInstanceClients for Instances the user can view.A ValueTask<TResult> resulting in a List<T> ...
IInstanceClient CreateClient(Instance instance)
Create an IInstanceClient for a given Instance.A new IInstanceClient.
Client that deals with getting paginated results.
Settings for a paginated request.
Web interface for the API.
Definition IApiClient.cs:17