tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Tgstation.Server.Client.AdministrationClient Class Referencesealed

More...

Inheritance diagram for Tgstation.Server.Client.AdministrationClient:
Inheritance graph
[legend]
Collaboration diagram for Tgstation.Server.Client.AdministrationClient:
Collaboration graph
[legend]

Public Member Functions

 AdministrationClient (IApiClient apiClient)
 Initializes a new instance of the AdministrationClient class.
 
ValueTask< AdministrationResponseRead (bool forceFresh, CancellationToken cancellationToken)
 Get the AdministrationResponse represented by the IAdministrationClient.
Parameters
forceFreshIf true the response will be forcefully regenerated.
cancellationTokenThe CancellationToken for the operation.
Returns
A ValueTask<TResult> resulting in the AdministrationResponse represented by the IAdministrationClient.

 
async ValueTask< ServerUpdateResponseUpdate (ServerUpdateRequest updateRequest, Stream? zipFileStream, CancellationToken cancellationToken)
 Updates the AdministrationResponse setttings.
Parameters
updateRequestThe ServerUpdateRequest.
zipFileStreamThe Stream for the .zip file if ServerUpdateRequest.UploadZip is true. Will be ignored if it is false.
cancellationTokenThe CancellationToken for the operation.
Returns
A ValueTask<TResult> resulting in the echoed ServerUpdateResponse.

 
ValueTask Restart (CancellationToken cancellationToken)
 Restarts the TGS server.
Parameters
cancellationTokenThe CancellationToken for the operation.
Returns
A ValueTask representing the running operation.

 
ValueTask< List< LogFileResponse > > ListLogs (PaginationSettings? paginationSettings, CancellationToken cancellationToken)
 Lists the log files available for download.
Parameters
paginationSettingsThe optional PaginationSettings for the operation.
cancellationTokenThe CancellationToken for the operation.
Returns
A ValueTask<TResult> resulting in an List<T> of LogFileResponse metadata.

 
async ValueTask< Tuple< LogFileResponse, Stream > > GetLog (LogFileResponse logFile, CancellationToken cancellationToken)
 Download a given logFile .
Parameters
logFileThe LogFileResponse to download.
cancellationTokenThe CancellationToken for the operation.
Returns
A ValueTask<TResult> resulting a Tuple<T1, T2> containing the downloaded LogFileResponse and associated Stream.

 
- Public Member Functions inherited from Tgstation.Server.Client.PaginatedClient
 PaginatedClient (IApiClient apiClient)
 Initializes a new instance of the PaginatedClient class.
 

Additional Inherited Members

- Protected Member Functions inherited from Tgstation.Server.Client.PaginatedClient
async ValueTask< List< TModel > > ReadPaged< TModel > (PaginationSettings? paginationSettings, string route, long? instanceId, CancellationToken cancellationToken)
 Reads a given route with paged results.
 
- Properties inherited from Tgstation.Server.Client.PaginatedClient
IApiClient ApiClient [get]
 The IApiClient for the PaginatedClient.
 

Detailed Description

Definition at line 15 of file AdministrationClient.cs.

Constructor & Destructor Documentation

◆ AdministrationClient()

Tgstation.Server.Client.AdministrationClient.AdministrationClient ( IApiClient  apiClient)

Initializes a new instance of the AdministrationClient class.

Parameters
apiClientThe IApiClient for the PaginatedClient.

Definition at line 21 of file AdministrationClient.cs.

22 : base(apiClient)
23 {
24 }

Member Function Documentation

◆ GetLog()

async ValueTask< Tuple< LogFileResponse, Stream > > Tgstation.Server.Client.AdministrationClient.GetLog ( LogFileResponse  logFile,
CancellationToken  cancellationToken 
)

Download a given logFile .

Parameters
logFileThe LogFileResponse to download.
cancellationTokenThe CancellationToken for the operation.
Returns
A ValueTask<TResult> resulting a Tuple<T1, T2> containing the downloaded LogFileResponse and associated Stream.

Implements Tgstation.Server.Client.IAdministrationClient.

Definition at line 60 of file AdministrationClient.cs.

61 {
62 var resultFile = await ApiClient.Read<LogFileResponse>(
63 Routes.Logs + Routes.SanitizeGetPath(
64 HttpUtility.UrlEncode(
65 logFile?.Name ?? throw new ArgumentNullException(nameof(logFile)))),
66 cancellationToken)
67 .ConfigureAwait(false);
68
69 var stream = await ApiClient.Download(resultFile, cancellationToken).ConfigureAwait(false);
70 try
71 {
72 return Tuple.Create(resultFile, stream);
73 }
74 catch
75 {
76 stream.Dispose();
77 throw;
78 }
79 }
Routes to a server actions.
Definition Routes.cs:9
static string SanitizeGetPath(string path)
Sanitize a Models.Response.FileTicketResponse path for use in a GET Uri.
Definition Routes.cs:140
IApiClient ApiClient
The IApiClient for the PaginatedClient.
ValueTask< Stream > Download(FileTicketResponse ticket, CancellationToken cancellationToken)
Downloads a file Stream for a given ticket .

References Tgstation.Server.Client.ApiClient.Download(), Tgstation.Server.Api.Models.Response.LogFileResponse.Name, and Tgstation.Server.Api.Routes.SanitizeGetPath().

Here is the call graph for this function:

◆ ListLogs()

ValueTask< List< LogFileResponse > > Tgstation.Server.Client.AdministrationClient.ListLogs ( PaginationSettings paginationSettings,
CancellationToken  cancellationToken 
)

Lists the log files available for download.

Parameters
paginationSettingsThe optional PaginationSettings for the operation.
cancellationTokenThe CancellationToken for the operation.
Returns
A ValueTask<TResult> resulting in an List<T> of LogFileResponse metadata.

Implements Tgstation.Server.Client.IAdministrationClient.

◆ Read()

ValueTask< AdministrationResponse > Tgstation.Server.Client.AdministrationClient.Read ( bool  forceFresh,
CancellationToken  cancellationToken 
)

Get the AdministrationResponse represented by the IAdministrationClient.

Parameters
forceFreshIf true the response will be forcefully regenerated.
cancellationTokenThe CancellationToken for the operation.
Returns
A ValueTask<TResult> resulting in the AdministrationResponse represented by the IAdministrationClient.

Implements Tgstation.Server.Client.IAdministrationClient.

◆ Restart()

ValueTask Tgstation.Server.Client.AdministrationClient.Restart ( CancellationToken  cancellationToken)

Restarts the TGS server.

Parameters
cancellationTokenThe CancellationToken for the operation.
Returns
A ValueTask representing the running operation.

Implements Tgstation.Server.Client.IAdministrationClient.

◆ Update()

async ValueTask< ServerUpdateResponse > Tgstation.Server.Client.AdministrationClient.Update ( ServerUpdateRequest  updateRequest,
Stream zipFileStream,
CancellationToken  cancellationToken 
)

Updates the AdministrationResponse setttings.

Parameters
updateRequestThe ServerUpdateRequest.
zipFileStreamThe Stream for the .zip file if ServerUpdateRequest.UploadZip is true. Will be ignored if it is false.
cancellationTokenThe CancellationToken for the operation.
Returns
A ValueTask<TResult> resulting in the echoed ServerUpdateResponse.

Implements Tgstation.Server.Client.IAdministrationClient.

Definition at line 30 of file AdministrationClient.cs.

34 {
35 if (updateRequest == null)
36 throw new ArgumentNullException(nameof(updateRequest));
37
38 if (updateRequest.UploadZip == true && zipFileStream == null)
39 throw new ArgumentNullException(nameof(zipFileStream));
40
41 var result = await ApiClient.Update<ServerUpdateRequest, ServerUpdateResponse>(
43 updateRequest,
44 cancellationToken);
45
46 if (updateRequest.UploadZip == true)
47 await ApiClient.Upload(result, zipFileStream, cancellationToken).ConfigureAwait(false);
48
49 return result;
50 }
bool? UploadZip
If the user will provide the server update package .zip file via file transfer as opposed to TGS retr...
const string Administration
The server administration controller.
Definition Routes.cs:28
ValueTask Upload(FileTicketResponse ticket, Stream? uploadStream, CancellationToken cancellationToken)
Uploads a given uploadStream for a given ticket .

References Tgstation.Server.Api.Routes.Administration, Tgstation.Server.Client.ApiClient.Upload(), and Tgstation.Server.Api.Models.Request.ServerUpdateRequest.UploadZip.

Here is the call graph for this function:

The documentation for this class was generated from the following file: