mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-26 14:37:44 +01:00
Byond client
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
namespace Tgstation.Server.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// The status of a BYOND update job
|
||||
/// </summary>
|
||||
#pragma warning disable CA1717 // Only FlagsAttribute enums should have plural names
|
||||
public enum ByondStatus
|
||||
#pragma warning restore CA1717 // Only FlagsAttribute enums should have plural names
|
||||
{
|
||||
/// <summary>
|
||||
/// No update in progress
|
||||
/// </summary>
|
||||
Idle,
|
||||
/// <summary>
|
||||
/// Preparing to update
|
||||
/// </summary>
|
||||
Starting,
|
||||
/// <summary>
|
||||
/// Revision is downloading
|
||||
/// </summary>
|
||||
Downloading,
|
||||
/// <summary>
|
||||
/// Revision is deflating
|
||||
/// </summary>
|
||||
Staging,
|
||||
/// <summary>
|
||||
/// Revision is ready and waiting for DreamDaemon reboot
|
||||
/// </summary>
|
||||
Staged,
|
||||
/// <summary>
|
||||
/// Revision is being applied
|
||||
/// </summary>
|
||||
Updating,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Tgstation.Server.Api.Models;
|
||||
using Tgstation.Server.Client.Rights;
|
||||
|
||||
namespace Tgstation.Server.Client.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// For managing the BYOND installation
|
||||
/// </summary>
|
||||
public interface IByondClient : IClient<ByondRights>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the current status of any BYOND updates
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="Task{TResult}"/> resulting in the <see cref="ByondStatus"/> updater</returns>
|
||||
Task<ByondStatus> CurrentStatus();
|
||||
|
||||
/// <summary>
|
||||
/// Updates the installed BYOND <see cref="Version"/>
|
||||
/// </summary>
|
||||
/// <param name="version">The <see cref="Version"/> to update to. Only considers the <see cref="Version.Major"/> and <see cref="Version.Minor"/> numbers</param>
|
||||
/// <returns>A <see cref="Task"/> representing the running operation</returns>
|
||||
Task UpdateToVersion(Version version);
|
||||
|
||||
/// <summary>
|
||||
/// Get the currently installed BYOND <see cref="Version"/>
|
||||
/// </summary>
|
||||
/// <param name="staged">Read the staged <see cref="Version"/> instead if applicable</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> resulting in the installed BYOND version or <see langword="null"/> if none is installed</returns>
|
||||
Task<Version> GetVersion(bool staged);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
using Tgstation.Server.Api.Models;
|
||||
using Tgstation.Server.Client.Rights;
|
||||
|
||||
namespace Tgstation.Server.Client
|
||||
namespace Tgstation.Server.Client.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// <see cref="IClient{TRights}"/> for server instances
|
||||
@@ -12,5 +12,10 @@ namespace Tgstation.Server.Client
|
||||
/// The <see cref="Instance"/> of the <see cref="IInstanceClient"/>
|
||||
/// </summary>
|
||||
Instance Metadata { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Access the <see cref="IByondClient"/>
|
||||
/// </summary>
|
||||
IByondClient Byond { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
|
||||
namespace Tgstation.Server.Client.Rights
|
||||
{
|
||||
/// <summary>
|
||||
/// Rights for <see cref="Components.IByondClient"/>
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum ByondRights
|
||||
{
|
||||
/// <summary>
|
||||
/// User has no rights
|
||||
/// </summary>
|
||||
None = 0,
|
||||
/// <summary>
|
||||
/// User may check the installed BYOND version
|
||||
/// </summary>
|
||||
ReadInstalled = 1,
|
||||
/// <summary>
|
||||
/// User may check the staged BYOND version
|
||||
/// </summary>
|
||||
ReadStaged = 2,
|
||||
/// <summary>
|
||||
/// User may install any BYOND version if none is installed
|
||||
/// </summary>
|
||||
Install = 4,
|
||||
/// <summary>
|
||||
/// User may upgrade the installed BYOND version
|
||||
/// </summary>
|
||||
Upgrade = 8,
|
||||
/// <summary>
|
||||
/// User may downgrade the installed BYOND version
|
||||
/// </summary>
|
||||
Downgrade = 16,
|
||||
/// <summary>
|
||||
/// User may cancel any pending installation job
|
||||
/// </summary>
|
||||
Cancel = 32
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,18 @@
|
||||
namespace Tgstation.Server.Client.Rights
|
||||
{
|
||||
/// <summary>
|
||||
/// Rights for an <see cref="IInstanceClient"/>
|
||||
/// Rights for an <see cref="Components.IInstanceClient"/>
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum InstanceRights
|
||||
{
|
||||
/// <summary>
|
||||
/// User has no rights
|
||||
/// </summary>
|
||||
None = 0,
|
||||
/// <summary>
|
||||
/// Allow access to <see cref="Components.IByondClient"/>
|
||||
/// </summary>
|
||||
Byond = 1,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Tgstation.Server.Client.Rights
|
||||
public enum ServerRights
|
||||
{
|
||||
/// <summary>
|
||||
/// Client has no rights
|
||||
/// User has no rights
|
||||
/// </summary>
|
||||
None = 0,
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user