diff --git a/_administration_authority_8cs.html b/_administration_authority_8cs.html new file mode 100644 index 0000000000..f03128a5f7 --- /dev/null +++ b/_administration_authority_8cs.html @@ -0,0 +1,108 @@ + + + + + + + +tgstation-server: src/Tgstation.Server.Host/Authority/AdministrationAuthority.cs File Reference + + + + + + + + + +
+
+ + + + + + +
+
tgstation-server 6.11.1 +
+
The /tg/station 13 server suite
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ + +
+
+
+Classes | +Namespaces
+
AdministrationAuthority.cs File Reference
+
+
+ +

Go to the source code of this file.

+ + + + +

+Classes

class  Tgstation.Server.Host.Authority.AdministrationAuthority
 
+ + + + + + + + + +

+Namespaces

namespace  Tgstation
 
namespace  Tgstation.Server
 
namespace  Tgstation.Server.Host
 
namespace  Tgstation.Server.Host.Authority
 
+
+ + + + diff --git a/_administration_authority_8cs_source.html b/_administration_authority_8cs_source.html new file mode 100644 index 0000000000..5da56e3184 --- /dev/null +++ b/_administration_authority_8cs_source.html @@ -0,0 +1,359 @@ + + + + + + + +tgstation-server: src/Tgstation.Server.Host/Authority/AdministrationAuthority.cs Source File + + + + + + + + + +
+
+ + + + + + +
+
tgstation-server 6.11.1 +
+
The /tg/station 13 server suite
+
+
+ + + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ + +
+
+
AdministrationAuthority.cs
+
+
+Go to the documentation of this file.
1using System;
+ + +
4
+ + +
7
+
8using Octokit;
+
9
+ + + + + + + + + +
19
+
+ +
21{
+
+ +
24 {
+
28 const string OctokitException = "Bad GitHub API response, check configuration!";
+
29
+
33 static readonly object ReadCacheKey = new();
+
34
+ +
39
+ +
44
+ +
49
+ +
54
+ +
59
+ +
91
+
+ +
94 {
+
95 try
+
96 {
+ +
98 {
+
99 Version? greatestVersion = null;
+
100 Uri? repoUrl = null;
+
101 try
+
102 {
+ +
104 var repositoryUrlTask = gitHubService.GetUpdatesRepositoryUrl(cancellationToken);
+ +
106
+
107 foreach (var kvp in releases)
+
108 {
+
109 var version = kvp.Key;
+
110 var release = kvp.Value;
+
111 if (version.Major > 3 // Forward/backward compatible but not before TGS4
+
112 && (greatestVersion == null || version > greatestVersion))
+ +
114 }
+
115
+ +
117 }
+
118 catch (NotFoundException e)
+
119 {
+
120 Logger.LogWarning(e, "Not found exception while retrieving upstream repository info!");
+
121 }
+
122
+
123 return new AdministrationResponse
+
124 {
+
125 LatestVersion = greatestVersion,
+
126 TrackedRepositoryUrl = repoUrl,
+
127 GeneratedAt = DateTimeOffset.UtcNow,
+
128 };
+
129 }
+
130
+
131 var ttl = TimeSpan.FromMinutes(30);
+ + +
134 {
+
135 using var entry = cacheService.CreateEntry(ReadCacheKey);
+ +
137 entry.Value = task = CacheFactory();
+
138 }
+
139 else
+ +
141
+ +
143 }
+ +
145 {
+ +
147 }
+
148 catch (ApiException e)
+
149 {
+
150 Logger.LogWarning(e, OctokitException);
+ +
152 new ErrorMessageResponse(ErrorCode.RemoteApiError)
+
153 {
+
154 AdditionalData = e.Message,
+
155 },
+
156 HttpFailureResponse.FailedDependency);
+
157 }
+
158 }
+
+
159
+
+ +
162 {
+ + +
165 {
+ + +
168 }
+ + +
171
+
172 if (targetVersion.Major < 4)
+
173 return BadRequest<ServerUpdateResponse>(ErrorCode.CannotChangeServerSuite);
+
174
+ + +
177 new ErrorMessageResponse(ErrorCode.MissingHostWatchdog),
+
178 HttpFailureResponse.UnprocessableEntity);
+
179
+ + +
182 : null;
+
183
+ +
185 try
+
186 {
+
187 try
+
188 {
+ +
190 }
+
191 catch
+
192 {
+ +
194 await uploadTicket!.DisposeAsync();
+
195
+
196 throw;
+
197 }
+
198 }
+ +
200 {
+ +
202 }
+
203 catch (ApiException e)
+
204 {
+
205 Logger.LogWarning(e, OctokitException);
+ +
207 new ErrorMessageResponse(ErrorCode.RemoteApiError)
+
208 {
+
209 AdditionalData = e.Message,
+
210 },
+
211 HttpFailureResponse.FailedDependency);
+
212 }
+
213
+
214 return updateResult switch
+
215 {
+ + + + +
220 new ErrorMessageResponse(ErrorCode.SwarmIntegrityCheckFailed),
+
221 HttpFailureResponse.FailedDependency),
+
222 _ => throw new InvalidOperationException($"Unexpected ServerUpdateResult: {updateResult}"),
+
223 };
+
224 }
+
+
225
+
+ +
228 {
+ +
230 {
+
231 Logger.LogDebug("Restart request failed due to lack of host watchdog!");
+
232 return new AuthorityResponse(
+
233 new ErrorMessageResponse(ErrorCode.MissingHostWatchdog),
+
234 HttpFailureResponse.UnprocessableEntity);
+
235 }
+
236
+ +
238 return new AuthorityResponse();
+
239 }
+
+
240 }
+
+
241}
+
+
AdministrationRights? AdministrationRights
The Rights.AdministrationRights for the user.
+ +
Represents an error message returned by the server.
+ + +
async ValueTask< AuthorityResponse< ServerUpdateResponse > > TriggerServerVersionChange(Version targetVersion, bool uploadZip, CancellationToken cancellationToken)
Triggers a restart of tgstation-server without terminating running game instances,...
+
AdministrationAuthority(IAuthenticationContext authenticationContext, IDatabaseContext databaseContext, ILogger< UserAuthority > logger, IGitHubServiceFactory gitHubServiceFactory, IServerControl serverControl, IServerUpdateInitiator serverUpdateInitiator, IFileTransferTicketProvider fileTransferService, IMemoryCache cacheService)
Initializes a new instance of the AdministrationAuthority class.
+
readonly IFileTransferTicketProvider fileTransferService
The IFileTransferTicketProvider for the AdministrationAuthority.
+
readonly IServerControl serverControl
The IServerControl for the AdministrationAuthority.
+
readonly IMemoryCache cacheService
The IMemoryCache for the AdministrationAuthority.
+
async ValueTask< AuthorityResponse > TriggerServerRestart()
Triggers a restart of tgstation-server without terminating running game instances....
+
const string OctokitException
Default Exception.Message for ApiExceptions.
+
async ValueTask< AuthorityResponse< AdministrationResponse > > GetUpdateInformation(bool forceFresh, CancellationToken cancellationToken)
Gets the AdministrationResponse containing server update information.A ValueTask<TResult> resulting i...
+
readonly IServerUpdateInitiator serverUpdateInitiator
The IServerUpdateInitiator for the AdministrationAuthority.
+
static readonly object ReadCacheKey
The IMemoryCache key for GetUpdateInformation(bool, CancellationToken).
+
readonly IGitHubServiceFactory gitHubServiceFactory
The IGitHubServiceFactory for the AdministrationAuthority.
+ +
ILogger< AuthorityBase > Logger
Gets the ILogger for the AuthorityBase.
+ + +
PermissionSet PermissionSet
The User's effective PermissionSet.
+
IAuthority for administrative server operations.
+
Represents a service that may take an updated Host assembly and run it, stopping the current assembly...
+
bool WatchdogPresent
true if live updates are supported, false. TryStartUpdate(IServerUpdateExecutor, Version) and Restart...
+
ValueTask Restart()
Restarts the Host.
+ +
ValueTask< ServerUpdateResult > InitiateUpdate(IFileStreamProvider? fileStreamProvider, Version version, CancellationToken cancellationToken)
Start the process of downloading and applying an update to a new server version .
+ +
For creating and accessing authentication contexts.
+
Service for temporarily storing files to be downloaded or uploaded.
+
IFileUploadTicket CreateUpload(FileUploadStreamKind streamKind)
Create a IFileUploadTicket.
+
A FileTicketResponse that waits for a pending upload.
+ +
ValueTask< IGitHubService > CreateService(CancellationToken cancellationToken)
Create a IGitHubService.
+ + +
ErrorCode
Types of Response.ErrorMessageResponses that the API may return.
Definition ErrorCode.cs:12
+ +
@ List
User may list files if the Models.Instance allows it.
+
AdministrationRights
Administration rights for the server.
+ +
HttpFailureResponse
Indicates the type of HTTP status code an failing AuthorityResponse should generate.
+
HttpSuccessResponse
Indicates the type of HTTP status code a successful AuthorityResponse<TResult> should generate.
+ + +
ServerUpdateResult
The result of a call to start a server update.
+ + + +
FileUploadStreamKind
Determines the type of global::System.IO.Stream returned from IFileUploadTicket's created from IFileT...
+ +
+ + + + diff --git a/_administration_controller_8cs_source.html b/_administration_controller_8cs_source.html index 943b43b421..4013869be1 100644 --- a/_administration_controller_8cs_source.html +++ b/_administration_controller_8cs_source.html @@ -85,372 +85,214 @@ $(document).ready(function() { init_codefold(0); }); Go to the documentation of this file.
1using System;
2using System.IO;
3using System.Linq;
-
4using System.Net;
-
5using System.Threading;
-
6using System.Threading.Tasks;
-
7using System.Web;
-
8
-
9using Microsoft.AspNetCore.Mvc;
-
10using Microsoft.Extensions.Caching.Memory;
-
11using Microsoft.Extensions.Logging;
-
12using Microsoft.Extensions.Options;
-
13
-
14using Octokit;
-
15
-
16using Tgstation.Server.Api;
-
17using Tgstation.Server.Api.Models;
-
18using Tgstation.Server.Api.Models.Request;
-
19using Tgstation.Server.Api.Models.Response;
-
20using Tgstation.Server.Api.Rights;
-
21using Tgstation.Server.Host.Configuration;
-
22using Tgstation.Server.Host.Controllers.Results;
-
23using Tgstation.Server.Host.Core;
-
24using Tgstation.Server.Host.Database;
-
25using Tgstation.Server.Host.Extensions;
-
26using Tgstation.Server.Host.IO;
-
27using Tgstation.Server.Host.Security;
-
28using Tgstation.Server.Host.System;
-
29using Tgstation.Server.Host.Transfer;
-
30using Tgstation.Server.Host.Utils;
-
31using Tgstation.Server.Host.Utils.GitHub;
-
32
-
- -
34{
- -
- -
40 {
-
44 const string OctokitException = "Bad GitHub API response, check configuration!";
-
45
-
49 static readonly object ReadCacheKey = new();
-
50
- -
55
- -
60
- -
65
- -
70
- -
75
- -
80
- -
85
- -
90
- -
95
-
- -
113 IDatabaseContext databaseContext,
-
114 IAuthenticationContext authenticationContext,
- - - - - - - - - -
124 IOptions<FileLoggingConfiguration> fileLoggingConfigurationOptions,
-
125 IApiHeadersProvider apiHeadersProvider)
-
126 : base(
-
127 databaseContext,
-
128 authenticationContext,
-
129 apiHeadersProvider,
-
130 logger,
-
131 true)
-
132 {
- - - - - - - - -
141 fileLoggingConfiguration = fileLoggingConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(fileLoggingConfigurationOptions));
-
142 }
+ + +
6using System.Web;
+
7
+ + + +
11
+ + + + + + + + + + + + + + +
26
+
+ +
28{
+ +
+ +
34 {
+ +
39
+ +
44
+ +
49
+ +
54
+ +
59
+ +
64
+ -
143
-
153 [HttpGet]
-
154 [TgsAuthorize(AdministrationRights.ChangeVersion)]
- - - -
- -
159 {
-
160 try
-
161 {
- -
163 {
-
164 Version? greatestVersion = null;
-
165 Uri? repoUrl = null;
-
166 try
-
167 {
- -
169 var repositoryUrlTask = gitHubService.GetUpdatesRepositoryUrl(cancellationToken);
- -
171
-
172 foreach (var kvp in releases)
-
173 {
-
174 var version = kvp.Key;
-
175 var release = kvp.Value;
-
176 if (version.Major > 3 // Forward/backward compatible but not before TGS4
-
177 && (greatestVersion == null || version > greatestVersion))
- -
179 }
-
180
- -
182 }
-
183 catch (NotFoundException e)
-
184 {
-
185 Logger.LogWarning(e, "Not found exception while retrieving upstream repository info!");
-
186 }
-
187
-
188 return Json(new AdministrationResponse
-
189 {
-
190 LatestVersion = greatestVersion,
-
191 TrackedRepositoryUrl = repoUrl,
-
192 GeneratedAt = DateTimeOffset.UtcNow,
-
193 });
-
194 }
-
195
-
196 var ttl = TimeSpan.FromMinutes(30);
-
197 Task<JsonResult> task;
-
198 if (fresh == true || !cacheService.TryGetValue(ReadCacheKey, out var rawCacheObject))
-
199 {
-
200 using var entry = cacheService.CreateEntry(ReadCacheKey);
- -
202 entry.Value = task = CacheFactory();
-
203 }
-
204 else
- +
103
+
113 [HttpGet]
+ + + + + + +
120 this,
+
121 authority => authority.GetUpdateInformation(fresh ?? false, cancellationToken));
+
122
+
134 [HttpPost]
+ + + + + + +
+ +
142 {
+
143 ArgumentNullException.ThrowIfNull(model);
+
144
+
145 if (model.NewVersion == null)
+
146 return BadRequest(new ErrorMessageResponse(ErrorCode.ModelValidationFailure)
+
147 {
+
148 AdditionalData = "newVersion is required!",
+
149 });
+
150
+ +
152 this,
+
153 authority => authority.TriggerServerVersionChange(model.NewVersion, model.UploadZip ?? false, cancellationToken));
+
154 }
+
+
155
+
162 [HttpDelete]
+ + + + +
167#pragma warning disable API1001 // Action returns undeclared success result
+ +
169 this,
+
170 authority => authority.TriggerServerRestart());
+
171#pragma warning restore API1001 // Action returns undeclared success result
+
172
+ +
183 [TgsAuthorize(AdministrationRights.DownloadLogs)]
+ + + +
187 => Paginated(
+
188 async () =>
+
189 {
+ +
191 try
+
192 {
+ +
194 var tasks = files.Select(
+ +
196 {
+
197 Name = ioManager.GetFileName(file),
+
198 LastModified = await ioManager
+
199 .GetLastModified(
+ + +
202 })
+
203 .ToList();
+
204
+
205 await Task.WhenAll(tasks);
206
-
207 return await task;
-
208 }
- -
210 {
-
211 return RateLimit(e);
-
212 }
-
213 catch (ApiException e)
-
214 {
-
215 Logger.LogWarning(e, OctokitException);
-
216 return this.StatusCode(HttpStatusCode.FailedDependency, new ErrorMessageResponse(ErrorCode.RemoteApiError)
-
217 {
-
218 AdditionalData = e.Message,
-
219 });
-
220 }
-
221 }
-
-
222
-
234 [HttpPost]
-
235 [TgsAuthorize(AdministrationRights.ChangeVersion | AdministrationRights.UploadVersion)]
- - - - - -
- -
242 {
-
243 ArgumentNullException.ThrowIfNull(model);
+ +
208 tasks
+
209 .AsQueryable()
+
210 .Select(x => x.Result)
+
211 .OrderByDescending(x => x.Name));
+
212 }
+
213 catch (IOException ex)
+
214 {
+ +
216 Conflict(new ErrorMessageResponse(ErrorCode.IOError)
+
217 {
+
218 AdditionalData = ex.ToString(),
+
219 }));
+
220 }
+
221 },
+
222 null,
+
223 page,
+
224 pageSize,
+ +
226
+
235 [HttpGet(Routes.Logs + "/{*path}")]
+
236 [TgsAuthorize(AdministrationRights.DownloadLogs)]
+ + +
+ +
240 {
+
241 ArgumentNullException.ThrowIfNull(path);
+
242
+
243 path = HttpUtility.UrlDecode(path);
244
- - -
247 {
- -
249 return Forbid();
-
250 }
- -
252 return Forbid();
-
253
-
254 if (model.NewVersion == null)
-
255 return BadRequest(new ErrorMessageResponse(ErrorCode.ModelValidationFailure)
-
256 {
-
257 AdditionalData = "newVersion is required!",
-
258 });
-
259
-
260 if (model.NewVersion.Major < 3)
-
261 return BadRequest(new ErrorMessageResponse(ErrorCode.CannotChangeServerSuite));
-
262
- -
264 return UnprocessableEntity(new ErrorMessageResponse(ErrorCode.MissingHostWatchdog));
-
265
- -
267 }
+
245 // guard against directory navigation
+ +
247 if (path != sanitizedPath)
+
248 return Forbid();
+
249
+ + +
252 path);
+
253 try
+
254 {
+ + +
257 () => null,
+
258 null,
+
259 fullPath,
+
260 true));
+
261
+
262 return Ok(new LogFileResponse
+
263 {
+
264 Name = path,
+ +
266 FileTicket = fileTransferTicket.FileTicket,
+
267 });
+
268 }
+
269 catch (IOException ex)
+
270 {
+
271 return Conflict(new ErrorMessageResponse(ErrorCode.IOError)
+
272 {
+
273 AdditionalData = ex.ToString(),
+
274 });
+
275 }
+
276 }
-
268
-
275 [HttpDelete]
- - - -
- -
280 {
-
281 try
-
282 {
- -
284 {
-
285 Logger.LogDebug("Restart request failed due to lack of host watchdog!");
-
286 return UnprocessableEntity(new ErrorMessageResponse(ErrorCode.MissingHostWatchdog));
-
287 }
-
288
- -
290 return NoContent();
-
291 }
- -
293 {
-
294 return StatusCode(HttpStatusCode.ServiceUnavailable);
-
295 }
-
296 }
+
277 }
-
297
- -
308 [TgsAuthorize(AdministrationRights.DownloadLogs)]
- - - -
312 => Paginated(
-
313 async () =>
-
314 {
- -
316 try
-
317 {
- -
319 var tasks = files.Select(
- -
321 {
-
322 Name = ioManager.GetFileName(file),
-
323 LastModified = await ioManager
-
324 .GetLastModified(
- - -
327 })
-
328 .ToList();
-
329
-
330 await Task.WhenAll(tasks);
-
331
- -
333 tasks
-
334 .AsQueryable()
-
335 .Select(x => x.Result)
-
336 .OrderByDescending(x => x.Name));
-
337 }
-
338 catch (IOException ex)
-
339 {
- -
341 Conflict(new ErrorMessageResponse(ErrorCode.IOError)
-
342 {
-
343 AdditionalData = ex.ToString(),
-
344 }));
-
345 }
-
346 },
-
347 null,
-
348 page,
-
349 pageSize,
- -
351
-
360 [HttpGet(Routes.Logs + "/{*path}")]
-
361 [TgsAuthorize(AdministrationRights.DownloadLogs)]
- - -
- -
365 {
-
366 ArgumentNullException.ThrowIfNull(path);
-
367
-
368 path = HttpUtility.UrlDecode(path);
-
369
-
370 // guard against directory navigation
- -
372 if (path != sanitizedPath)
-
373 return Forbid();
-
374
- - -
377 path);
-
378 try
-
379 {
- - -
382 () => null,
-
383 null,
-
384 fullPath,
-
385 true));
-
386
-
387 return Ok(new LogFileResponse
-
388 {
-
389 Name = path,
- -
391 FileTicket = fileTransferTicket.FileTicket,
-
392 });
-
393 }
-
394 catch (IOException ex)
-
395 {
-
396 return Conflict(new ErrorMessageResponse(ErrorCode.IOError)
-
397 {
-
398 AdditionalData = ex.ToString(),
-
399 });
-
400 }
-
401 }
+
278}
-
402
-
- -
411 {
- - -
414 : null;
-
415
- -
417 try
-
418 {
-
419 try
-
420 {
- -
422 }
-
423 catch
-
424 {
- -
426 await uploadTicket!.DisposeAsync();
-
427
-
428 throw;
-
429 }
-
430 }
- -
432 {
-
433 return RateLimit(e);
-
434 }
-
435 catch (ApiException e)
-
436 {
-
437 Logger.LogWarning(e, OctokitException);
-
438 return this.StatusCode(HttpStatusCode.FailedDependency, new ErrorMessageResponse(ErrorCode.RemoteApiError)
-
439 {
-
440 AdditionalData = e.Message,
-
441 });
-
442 }
-
443
-
444 return updateResult switch
-
445 {
-
446 ServerUpdateResult.Started => Accepted(new ServerUpdateResponse(newVersion, uploadTicket?.Ticket.FileTicket)),
- -
448 ServerUpdateResult.UpdateInProgress => BadRequest(new ErrorMessageResponse(ErrorCode.ServerUpdateInProgress)),
-
449 ServerUpdateResult.SwarmIntegrityCheckFailed => this.StatusCode(HttpStatusCode.FailedDependency, new ErrorMessageResponse(ErrorCode.SwarmIntegrityCheckFailed)),
-
450 _ => throw new InvalidOperationException($"Unexpected ServerUpdateResult: {updateResult}"),
-
451 };
-
452 }
-
-
453 }
-
-
454}
-
-
AdministrationRights? AdministrationRights
The Rights.AdministrationRights for the user.
Represents an error message returned by the server.
@@ -462,37 +304,28 @@ $(document).ready(function() { init_codefold(0); });
const string Logs
The endpoint to download server logs.
Definition Routes.cs:33
string GetFullLogDirectory(IIOManager ioManager, IAssemblyInformationProvider assemblyInformationProvider, IPlatformIdentifier platformIdentifier)
Gets the evaluated log Directory.
- + +
readonly IRestAuthorityInvoker< IAdministrationAuthority > administrationAuthority
The IRestAuthorityInvoker<TAuthority> for the IAdministrationAuthority.
+
ValueTask< IActionResult > Read([FromQuery] bool? fresh, CancellationToken cancellationToken)
Get AdministrationResponse server information.
+
AdministrationController(IDatabaseContext databaseContext, IAuthenticationContext authenticationContext, IApiHeadersProvider apiHeadersProvider, ILogger< AdministrationController > logger, IRestAuthorityInvoker< IAdministrationAuthority > administrationAuthority, IAssemblyInformationProvider assemblyInformationProvider, IIOManager ioManager, IPlatformIdentifier platformIdentifier, IFileTransferTicketProvider fileTransferService, IOptions< FileLoggingConfiguration > fileLoggingConfigurationOptions)
Initializes a new instance of the AdministrationController class.
ValueTask< IActionResult > ListLogs([FromQuery] int? page, [FromQuery] int? pageSize, CancellationToken cancellationToken)
List LogFileResponses present.
-
readonly FileLoggingConfiguration fileLoggingConfiguration
The FileLoggingConfiguration for the AdministrationController.
-
readonly IMemoryCache cacheService
The IMemoryCache for the AdministrationController.
-
readonly IAssemblyInformationProvider assemblyInformationProvider
The IAssemblyInformationProvider for the AdministrationController.
-
readonly IFileTransferTicketProvider fileTransferService
The IFileTransferTicketProvider for the AdministrationController.
-
async ValueTask< IActionResult > Read([FromQuery] bool? fresh, CancellationToken cancellationToken)
Get AdministrationResponse server information.
-
async ValueTask< IActionResult > Update([FromBody] ServerUpdateRequest model, CancellationToken cancellationToken)
Attempt to perform a server upgrade.
-
AdministrationController(IDatabaseContext databaseContext, IAuthenticationContext authenticationContext, IGitHubServiceFactory gitHubServiceFactory, IServerControl serverControl, IServerUpdateInitiator serverUpdateInitiator, IAssemblyInformationProvider assemblyInformationProvider, IIOManager ioManager, IPlatformIdentifier platformIdentifier, IFileTransferTicketProvider fileTransferService, IMemoryCache cacheService, ILogger< AdministrationController > logger, IOptions< FileLoggingConfiguration > fileLoggingConfigurationOptions, IApiHeadersProvider apiHeadersProvider)
Initializes a new instance of the AdministrationController class.
-
static readonly object ReadCacheKey
The IMemoryCache key for Read(bool?, CancellationToken).
-
async ValueTask< IActionResult > GetLog(string path, CancellationToken cancellationToken)
Download a LogFileResponse.
-
readonly IPlatformIdentifier platformIdentifier
The IPlatformIdentifier for the AdministrationController.
-
const string OctokitException
Default Exception.Message for ApiExceptions.
-
readonly IGitHubServiceFactory gitHubServiceFactory
The IGitHubServiceFactory for the AdministrationController.
-
readonly IIOManager ioManager
The IIOManager for the AdministrationController.
-
async ValueTask< IActionResult > AttemptInitiateUpdate(Version newVersion, bool attemptingUpload, CancellationToken cancellationToken)
Attempt to initiate an update.
-
async ValueTask< IActionResult > Delete()
Attempts to restart the server.
-
readonly IServerUpdateInitiator serverUpdateInitiator
The IServerUpdateInitiator for the AdministrationController.
-
readonly IServerControl serverControl
The IServerControl for the AdministrationController.
+
readonly FileLoggingConfiguration fileLoggingConfiguration
The FileLoggingConfiguration for the AdministrationController.
+
ValueTask< IActionResult > AdministrationResponse(this, authority=> authority.GetUpdateInformation(fresh ?? false, cancellationToken))
+
readonly IAssemblyInformationProvider assemblyInformationProvider
The IAssemblyInformationProvider for the AdministrationController.
+
ValueTask< IActionResult > Delete()
Attempts to restart the server.
+
readonly IFileTransferTicketProvider fileTransferService
The IFileTransferTicketProvider for the AdministrationController.
+
async ValueTask< IActionResult > Update([FromBody] ServerUpdateRequest model, CancellationToken cancellationToken)
Attempt to perform a server upgrade.
+
async ValueTask< IActionResult > GetLog(string path, CancellationToken cancellationToken)
Download a LogFileResponse.
+
readonly IPlatformIdentifier platformIdentifier
The IPlatformIdentifier for the AdministrationController.
+
readonly IIOManager ioManager
The IIOManager for the AdministrationController.
Base Controller for API functions.
-
StatusCodeResult StatusCode(HttpStatusCode statusCode)
Strongly type calls to ControllerBase.StatusCode(int).
-
ObjectResult RateLimit(RateLimitExceededException rateLimitException)
429 response for a given rateLimitException .
-
ILogger< ApiController > Logger
The ILogger for the ApiController.
- -
PermissionSet PermissionSet
The User's effective PermissionSet.
Represents a file on disk to be downloaded.
-
Represents a service that may take an updated Host assembly and run it, stopping the current assembly...
-
bool WatchdogPresent
true if live updates are supported, false. TryStartUpdate(IServerUpdateExecutor, Version) and Restart...
-
ValueTask Restart()
Restarts the Host.
- -
ValueTask< ServerUpdateResult > InitiateUpdate(IFileStreamProvider? fileStreamProvider, Version version, CancellationToken cancellationToken)
Start the process of downloading and applying an update to a new server version .
+
IAuthority for administrative server operations.
+
ValueTask< AuthorityResponse > TriggerServerRestart()
Triggers a restart of tgstation-server without terminating running game instances.
+
ValueTask< AuthorityResponse< ServerUpdateResponse > > TriggerServerVersionChange(Version targetVersion, bool uploadZip, CancellationToken cancellationToken)
Triggers a restart of tgstation-server without terminating running game instances,...
+
ValueTask< AuthorityResponse< AdministrationResponse > > GetUpdateInformation(bool forceFresh, CancellationToken cancellationToken)
Gets the AdministrationResponse containing server update information.
+
Invokes TAuthority methods and generates IActionResult responses.
+
ValueTask< IActionResult > Invoke(ApiController controller, Func< TAuthority, ValueTask< AuthorityResponse > > authorityInvoker)
Invoke a TAuthority method with no success result.
Interface for using filesystems.
Definition IIOManager.cs:13
Task< IReadOnlyList< string > > GetFiles(string path, CancellationToken cancellationToken)
Returns full file names in a given path .
@@ -504,10 +337,6 @@ $(document).ready(function() { init_codefold(0); });
For identifying the current platform.
Service for temporarily storing files to be downloaded or uploaded.
FileTicketResponse CreateDownload(FileDownloadProvider fileDownloadProvider)
Create a FileTicketResponse for a download.
-
IFileUploadTicket CreateUpload(FileUploadStreamKind streamKind)
Create a IFileUploadTicket.
-
A FileTicketResponse that waits for a pending upload.
- -
ValueTask< IGitHubService > CreateService(CancellationToken cancellationToken)
Create a IGitHubService.
@@ -517,19 +346,15 @@ $(document).ready(function() { init_codefold(0); });
@ List
User may list files if the Models.Instance allows it.
AdministrationRights
Administration rights for the server.
+ - - -
ServerUpdateResult
The result of a call to start a server update.
+ - -
FileUploadStreamKind
Determines the type of global::System.IO.Stream returned from IFileUploadTicket's created from IFileT...
-
diff --git a/_administration_mutations_8cs.html b/_administration_mutations_8cs.html new file mode 100644 index 0000000000..49b3cfacff --- /dev/null +++ b/_administration_mutations_8cs.html @@ -0,0 +1,111 @@ + + + + + + + +tgstation-server: src/Tgstation.Server.Host/GraphQL/Mutations/AdministrationMutations.cs File Reference + + + + + + + + + +
+
+ + + + + + +
+
tgstation-server 6.11.1 +
+
The /tg/station 13 server suite
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ + +
+
+ +
AdministrationMutations.cs File Reference
+
+
+ +

Go to the source code of this file.

+ + + + + +

+Classes

class  Tgstation.Server.Host.GraphQL.Mutations.AdministrationMutations
 IAdministrationAuthority related Mutations. More...
 
+ + + + + + + + + + + +

+Namespaces

namespace  Tgstation
 
namespace  Tgstation.Server
 
namespace  Tgstation.Server.Host
 
namespace  Tgstation.Server.Host.GraphQL
 
namespace  Tgstation.Server.Host.GraphQL.Mutations
 
+
+ + + + diff --git a/_administration_mutations_8cs_source.html b/_administration_mutations_8cs_source.html new file mode 100644 index 0000000000..7de3a42052 --- /dev/null +++ b/_administration_mutations_8cs_source.html @@ -0,0 +1,184 @@ + + + + + + + +tgstation-server: src/Tgstation.Server.Host/GraphQL/Mutations/AdministrationMutations.cs Source File + + + + + + + + + +
+
+ + + + + + +
+
tgstation-server 6.11.1 +
+
The /tg/station 13 server suite
+
+
+ + + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ + +
+
+
AdministrationMutations.cs
+
+
+Go to the documentation of this file.
1using System;
+ + +
4
+
5using HotChocolate;
+ +
7
+ + + + + +
13
+
+ +
15{
+ +
20 [GraphQLDescription(Mutation.GraphQLDescription)]
+
+
21 public sealed class AdministrationMutations
+
22 {
+ + +
+ +
31 [Service] IGraphQLAuthorityInvoker<IAdministrationAuthority> administrationAuthority)
+
32 {
+
33 ArgumentNullException.ThrowIfNull(administrationAuthority);
+
34 await administrationAuthority.Invoke(
+
35 authority => authority.TriggerServerRestart());
+
36
+
37 return new Query();
+
38 }
+
+
39
+ + +
+ +
50 Version targetVersion,
+
51 [Service] IGraphQLAuthorityInvoker<IAdministrationAuthority> administrationAuthority,
+
52 CancellationToken cancellationToken)
+
53 {
+ +
55 ArgumentNullException.ThrowIfNull(administrationAuthority);
+
56 await administrationAuthority.Invoke<ServerUpdateResponse, ServerUpdateResponse>(
+
57 authority => authority.TriggerServerVersionChange(targetVersion, false, cancellationToken));
+
58 return new Query();
+
59 }
+
+
60
+ + + +
+ +
72 Version targetVersion,
+
73 [Service] IGraphQLAuthorityInvoker<IAdministrationAuthority> administrationAuthority,
+
74 CancellationToken cancellationToken)
+
75 {
+ +
77 ArgumentNullException.ThrowIfNull(administrationAuthority);
+
78 var response = await administrationAuthority.Invoke<ServerUpdateResponse, FileTicketResponse>(
+
79 authority => authority.TriggerServerVersionChange(targetVersion, true, cancellationToken));
+
80
+
81 return response.FileTicket ?? throw new InvalidOperationException("Administration authority did not generate a FileUploadTicket!");
+
82 }
+
+
83 }
+
+
84}
+
+
Response for when file transfers are necessary.
+ +
Exception representing ErrorMessageResponses.
+
Root type for GraphQL mutations.
Definition Mutation.cs:19
+
const string GraphQLDescription
Description to show on the Mutation type.
Definition Mutation.cs:23
+ +
async ValueTask< Query > ChangeServerNodeVersionViaTrackedRepository(Version targetVersion, [Service] IGraphQLAuthorityInvoker< IAdministrationAuthority > administrationAuthority, CancellationToken cancellationToken)
Restarts the mutated Interfaces.IServerNode without terminating running game instances and changes it...
+
async ValueTask< Query > RestartServerNode([Service] IGraphQLAuthorityInvoker< IAdministrationAuthority > administrationAuthority)
Restarts the mutated Interfaces.IServerNode without terminating running game instances.
+
async ValueTask< string > ChangeServerNodeVersionViaUpload(Version targetVersion, [Service] IGraphQLAuthorityInvoker< IAdministrationAuthority > administrationAuthority, CancellationToken cancellationToken)
Restarts the mutated Interfaces.IServerNode without terminating running game instances and changes it...
+
GraphQL query global::System.Type.
Definition Query.cs:12
+
IAuthority for administrative server operations.
+
ValueTask< AuthorityResponse > TriggerServerRestart()
Triggers a restart of tgstation-server without terminating running game instances.
+ + + +
@ List
User may list files if the Models.Instance allows it.
+
AdministrationRights
Administration rights for the server.
+ + + + +
+ + + + diff --git a/_administration_response_8cs_source.html b/_administration_response_8cs_source.html index 8f01f824e2..33920a4d00 100644 --- a/_administration_response_8cs_source.html +++ b/_administration_response_8cs_source.html @@ -97,7 +97,7 @@ $(document).ready(function() { init_codefold(0); });
17}
-
Indicates data from the TGS update source.
+
Indicates data from the TGS update source.
Represents administrative server information.
Uri? TrackedRepositoryUrl
The GitHub repository the server is built to receive updates from.
diff --git a/_api_controller_8cs_source.html b/_api_controller_8cs_source.html index bbc8f8e0c6..d20613811a 100644 --- a/_api_controller_8cs_source.html +++ b/_api_controller_8cs_source.html @@ -419,7 +419,7 @@ $(document).ready(function() { init_codefold(0); });
HeaderErrorTypes
Types of individual ApiHeaders errors.
-
+
Definition ChatBot.cs:9
diff --git a/_api_controller_base_8cs_source.html b/_api_controller_base_8cs_source.html index 0e8e700531..e5bfcd6622 100644 --- a/_api_controller_base_8cs_source.html +++ b/_api_controller_base_8cs_source.html @@ -130,7 +130,7 @@ $(document).ready(function() { init_codefold(0); });
Base class for all API style controllers.
virtual async ValueTask< IActionResult?> HookExecuteAction(Func< Task > executeAction, CancellationToken cancellationToken)
Hook for executing a request.
override async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
-
+