From 14ac2e91efc5acb835f2ddb29896481b54b0c9f3 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Mon, 2 Apr 2018 12:45:17 -0400 Subject: [PATCH] Questionable behaviour refactor --- .../Rights/ServerRights.cs | 24 ----------------- .../Components/IByondClient.cs | 9 +------ .../Components/IInstanceClient.cs | 9 ++----- .../Components/IInstanceManagerClient.cs | 15 +++-------- .../Components/ITokenClient.cs | 13 +++------- src/Tgstation.Server.Client/IClient.cs | 26 +++++++++---------- src/Tgstation.Server.Client/IServerClient.cs | 19 ++++++++++---- 7 files changed, 36 insertions(+), 79 deletions(-) delete mode 100644 src/Tgstation.Server.Api/Rights/ServerRights.cs diff --git a/src/Tgstation.Server.Api/Rights/ServerRights.cs b/src/Tgstation.Server.Api/Rights/ServerRights.cs deleted file mode 100644 index 60f6e98172..0000000000 --- a/src/Tgstation.Server.Api/Rights/ServerRights.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; - -namespace Tgstation.Server.Api.Rights -{ - /// - /// Rights a user has for an entire server - /// - [Flags] - public enum ServerRights - { - /// - /// User has no rights - /// - None = 0, - /// - /// Allow access to the of the server - /// - Version = 1, - /// - /// Allow access to s - /// - Tokens = 2, - } -} \ No newline at end of file diff --git a/src/Tgstation.Server.Client/Components/IByondClient.cs b/src/Tgstation.Server.Client/Components/IByondClient.cs index 942fcf1fc7..a8415c3570 100644 --- a/src/Tgstation.Server.Client/Components/IByondClient.cs +++ b/src/Tgstation.Server.Client/Components/IByondClient.cs @@ -9,15 +9,8 @@ namespace Tgstation.Server.Client.Components /// /// For managing the BYOND installation /// - public interface IByondClient : IClient + public interface IByondClient : IClient { - /// - /// Gets the current status of any BYOND updates - /// - /// The for the operation - /// A resulting in the updater - Task Read(CancellationToken cancellationToken); - /// /// Updates the installed BYOND /// diff --git a/src/Tgstation.Server.Client/Components/IInstanceClient.cs b/src/Tgstation.Server.Client/Components/IInstanceClient.cs index 03b2a06e70..5710aadda9 100644 --- a/src/Tgstation.Server.Client/Components/IInstanceClient.cs +++ b/src/Tgstation.Server.Client/Components/IInstanceClient.cs @@ -4,15 +4,10 @@ using Tgstation.Server.Api.Rights; namespace Tgstation.Server.Client.Components { /// - /// for server instances + /// for server instances /// - public interface IInstanceClient : IClient + public interface IInstanceClient : IClient { - /// - /// The of the - /// - Instance Metadata { get; } - /// /// Access the /// diff --git a/src/Tgstation.Server.Client/Components/IInstanceManagerClient.cs b/src/Tgstation.Server.Client/Components/IInstanceManagerClient.cs index d8eb5493c6..f4197a8bfe 100644 --- a/src/Tgstation.Server.Client/Components/IInstanceManagerClient.cs +++ b/src/Tgstation.Server.Client/Components/IInstanceManagerClient.cs @@ -9,22 +9,15 @@ namespace Tgstation.Server.Client.Components /// /// Manager for s /// - public interface IInstanceManagerClient : IClient + public interface IInstanceManagerClient : IClient> { - /// - /// Get all s for s that the can view - /// - /// The for the operation - /// A resulting in a of s - Task> GetInstanceClients(CancellationToken cancellationToken); - /// /// Create an /// /// The to create. will be ignored /// The for the operation /// A resulting in for the created - Task CreateInstance(Instance instance, CancellationToken cancellationToken); + Task Create(Instance instance, CancellationToken cancellationToken); /// /// Relocates, renamed, and/or on/offlines an @@ -32,7 +25,7 @@ namespace Tgstation.Server.Client.Components /// The to update /// The for the operation /// A representing the running operation - Task UpdateInstance(Instance instance, CancellationToken cancellationToken); + Task Update(Instance instance, CancellationToken cancellationToken); /// /// Deletes an @@ -40,6 +33,6 @@ namespace Tgstation.Server.Client.Components /// The to delete /// The for the operation /// A representing the running operation - Task DeleteInstance(Instance instance, CancellationToken cancellationToken); + Task Delete(Instance instance, CancellationToken cancellationToken); } } diff --git a/src/Tgstation.Server.Client/Components/ITokenClient.cs b/src/Tgstation.Server.Client/Components/ITokenClient.cs index 155975f528..c93a853944 100644 --- a/src/Tgstation.Server.Client/Components/ITokenClient.cs +++ b/src/Tgstation.Server.Client/Components/ITokenClient.cs @@ -9,27 +9,20 @@ namespace Tgstation.Server.Client.Components /// /// for managing s /// - public interface ITokenClient: IClient + public interface ITokenClient: IClient { - /// - /// Generates a new token for the 's - /// - /// The for the operation - /// A resulting in a new for the - Task Generate(CancellationToken cancellationToken); - /// /// Gets all active s for the /// /// The for the operation - /// A resulting a of active s for the + /// A resulting a of active s for the Task> GetClientInfos(CancellationToken cancellationToken); /// /// Gets all active s for all users /// /// The for the operation - /// A resulting a of active s for the keyed by username + /// A resulting a of active s for the keyed by username Task> GetAllInfos(CancellationToken cancellationToken); /// diff --git a/src/Tgstation.Server.Client/IClient.cs b/src/Tgstation.Server.Client/IClient.cs index b83a7248d6..8fd0598243 100644 --- a/src/Tgstation.Server.Client/IClient.cs +++ b/src/Tgstation.Server.Client/IClient.cs @@ -6,24 +6,22 @@ namespace Tgstation.Server.Client /// /// Basic client /// - /// The for the - public interface IClient + /// The for the + /// Which of the the represents + public interface IClient { /// - /// The connection timeout in milliseconds - /// - int Timeout { get; set; } - - /// - /// The requery rate for job updates in milliseconds - /// - int RequeryRate { get; set; } - - /// - /// Get the for the + /// Get the for the /// /// The for the operation - /// A resulting in the for the + /// A resulting in the for the Task Rights(CancellationToken cancellationToken); + + /// + /// Read the of the + /// + /// The for the operation + /// The of the + Task Read(CancellationToken cancellationToken); } } diff --git a/src/Tgstation.Server.Client/IServerClient.cs b/src/Tgstation.Server.Client/IServerClient.cs index 72f602066d..406ae13b26 100644 --- a/src/Tgstation.Server.Client/IServerClient.cs +++ b/src/Tgstation.Server.Client/IServerClient.cs @@ -2,29 +2,38 @@ using System.Threading; using System.Threading.Tasks; using Tgstation.Server.Client.Components; -using Tgstation.Server.Api.Rights; namespace Tgstation.Server.Client { /// - /// for communicating with a server + /// Main client for communicating with a server /// - public interface IServerClient : IDisposable, IClient + public interface IServerClient : IDisposable { /// /// The of the /// Version Version { get; } + /// + /// The connection timeout in milliseconds + /// + int Timeout { get; set; } + + /// + /// The requery rate for job updates in milliseconds + /// + int RequeryRate { get; set; } + /// /// Access the /// - ITokenClient Token { get; } + ITokenClient Tokens { get; } /// /// Access the /// - IInstanceManagerClient Instance { get; } + IInstanceManagerClient Instances { get; } /// /// The of the connected server