diff --git a/src/Tgstation.Server.Api/Routes.cs b/src/Tgstation.Server.Api/Routes.cs
index 744b874716..baa11b5859 100644
--- a/src/Tgstation.Server.Api/Routes.cs
+++ b/src/Tgstation.Server.Api/Routes.cs
@@ -1,4 +1,7 @@
-namespace Tgstation.Server.Api
+using System;
+using System.Globalization;
+
+namespace Tgstation.Server.Api
{
///
/// Routes to a server actions
@@ -19,5 +22,25 @@
/// The controller
///
public const string User = Root + nameof(Models.User);
+
+ ///
+ /// The controller
+ ///
+ public const string InstanceManager = Root + nameof(Models.Instance);
+
+ ///
+ /// Apply an postfix to a
+ ///
+ /// The route
+ /// The ID
+ /// The with appended
+ public static string SetID(string route, long id) => String.Format(CultureInfo.InvariantCulture, "{0}/{1}", route, id);
+
+ ///
+ /// Get the /List postfix for a
+ ///
+ /// The route
+ /// The with /List appended
+ public static string List(string route) => String.Format(CultureInfo.InvariantCulture, "{0}/List", route);
}
}
diff --git a/src/Tgstation.Server.Client/Components/InstanceClient.cs b/src/Tgstation.Server.Client/Components/InstanceClient.cs
new file mode 100644
index 0000000000..3d7f5f3457
--- /dev/null
+++ b/src/Tgstation.Server.Client/Components/InstanceClient.cs
@@ -0,0 +1,52 @@
+using System;
+using Tgstation.Server.Api.Models;
+
+namespace Tgstation.Server.Client.Components
+{
+ ///
+ sealed class InstanceClient : IInstanceClient
+ {
+ ///
+ public Instance Metadata { get; }
+
+ ///
+ public IByondClient Byond => throw new NotImplementedException();
+
+ ///
+ public IRepositoryClient Repository => throw new NotImplementedException();
+
+ ///
+ public IDreamDaemonClient DreamDaemon => throw new NotImplementedException();
+
+ ///
+ public IConfigurationClient Configuration => throw new NotImplementedException();
+
+ ///
+ public IInstanceUserClient Users => throw new NotImplementedException();
+
+ ///
+ public IChatBotsClient ChatBots => throw new NotImplementedException();
+
+ ///
+ public IDreamMakerClient DreamMaker => throw new NotImplementedException();
+
+ ///
+ public IJobsClient Jobs => throw new NotImplementedException();
+
+ ///
+ /// The for the
+ ///
+ readonly IApiClient apiClient;
+
+ ///
+ /// Construct a
+ ///
+ /// The value of
+ /// The value of
+ public InstanceClient(IApiClient apiClient, Instance instance)
+ {
+ this.apiClient = apiClient ?? throw new ArgumentNullException(nameof(apiClient));
+ Metadata = instance ?? throw new ArgumentNullException(nameof(instance));
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Tgstation.Server.Client/InstanceManagerClient.cs b/src/Tgstation.Server.Client/InstanceManagerClient.cs
new file mode 100644
index 0000000000..19c94aa075
--- /dev/null
+++ b/src/Tgstation.Server.Client/InstanceManagerClient.cs
@@ -0,0 +1,47 @@
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+using Tgstation.Server.Api;
+using Tgstation.Server.Api.Models;
+using Tgstation.Server.Client.Components;
+
+namespace Tgstation.Server.Client
+{
+ ///
+ sealed class InstanceManagerClient : IInstanceManagerClient
+ {
+ ///
+ /// The for the
+ ///
+ readonly IApiClient apiClient;
+
+ ///
+ /// Map of already created s
+ ///
+ readonly Dictionary cachedClients;
+
+ ///
+ /// Construct an
+ ///
+ ///
+ public InstanceManagerClient(IApiClient apiClient)
+ {
+ this.apiClient = apiClient;
+ }
+
+ ///
+ public Task Create(Instance instance, CancellationToken cancellationToken) => apiClient.Create(Routes.InstanceManager, instance, cancellationToken);
+
+ ///
+ public Task Delete(Instance instance, CancellationToken cancellationToken) => apiClient.Delete(Routes.SetID(Routes.InstanceManager, instance.Id), cancellationToken);
+
+ ///
+ public Task> List(CancellationToken cancellationToken) => apiClient.Read>(Routes.List(Routes.InstanceManager), cancellationToken);
+
+ ///
+ public Task Update(Instance instance, CancellationToken cancellationToken) => apiClient.Update(Routes.InstanceManager, instance, cancellationToken);
+
+ ///
+ public IInstanceClient CreateClient(Instance instance) => new InstanceClient(apiClient, instance);
+ }
+}
\ No newline at end of file
diff --git a/src/Tgstation.Server.Client/ServerClient.cs b/src/Tgstation.Server.Client/ServerClient.cs
index ea1c44151e..51b1e971ad 100644
--- a/src/Tgstation.Server.Client/ServerClient.cs
+++ b/src/Tgstation.Server.Client/ServerClient.cs
@@ -46,6 +46,7 @@ namespace Tgstation.Server.Client
if (Token.Bearer != apiClient.Headers.Token)
throw new ArgumentOutOfRangeException(nameof(token), token, "Provided token does not match apiClient headers!");
+ Instances = new InstanceManagerClient(apiClient);
Users = new UsersClient(apiClient);
Administration = new AdministrationClient(apiClient);
}
diff --git a/src/Tgstation.Server.Host/Controllers/InstanceController.cs b/src/Tgstation.Server.Host/Controllers/InstanceController.cs
index c86029f9bc..bd0b494ce7 100644
--- a/src/Tgstation.Server.Host/Controllers/InstanceController.cs
+++ b/src/Tgstation.Server.Host/Controllers/InstanceController.cs
@@ -12,6 +12,7 @@ using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
+using Tgstation.Server.Api;
using Tgstation.Server.Api.Models;
using Tgstation.Server.Api.Rights;
using Tgstation.Server.Host.Components;
@@ -25,7 +26,7 @@ namespace Tgstation.Server.Host.Controllers
///
/// Controller for managing s
///
- [Route("/Instance")]
+ [Route(Routes.InstanceManager)]
public sealed class InstanceController : ModelController
{
///