From 5906a2b5395b5d92f498b3b206e137b3def83ef8 Mon Sep 17 00:00:00 2001 From: Norm Johanson Date: Tue, 25 May 2021 09:39:00 -0700 Subject: [PATCH] feat: Generate interfaces for server mode clients --- .../DeploymentCommunicationClient.cs | 15 ++- src/AWS.Deploy.ServerMode.Client/RestAPI.cs | 95 ++++++++++++++++++- .../Program.cs | 1 + 3 files changed, 109 insertions(+), 2 deletions(-) diff --git a/src/AWS.Deploy.ServerMode.Client/DeploymentCommunicationClient.cs b/src/AWS.Deploy.ServerMode.Client/DeploymentCommunicationClient.cs index d59d94d30..5a5900e4b 100644 --- a/src/AWS.Deploy.ServerMode.Client/DeploymentCommunicationClient.cs +++ b/src/AWS.Deploy.ServerMode.Client/DeploymentCommunicationClient.cs @@ -10,7 +10,20 @@ namespace AWS.Deploy.ServerMode.Client { - public class DeploymentCommunicationClient : IDisposable + public interface IDeploymentCommunicationClient : IDisposable + { + Action? ReceiveLogDebugLine { get; set; } + + Action? ReceiveLogErrorMessageLine { get; set; } + + Action? ReceiveLogMessageLineAction { get; set; } + + Action? ReceiveLogAllLogAction { get; set; } + + Task JoinSession(string sessionId); + } + + public class DeploymentCommunicationClient : IDeploymentCommunicationClient { private bool _disposedValue; diff --git a/src/AWS.Deploy.ServerMode.Client/RestAPI.cs b/src/AWS.Deploy.ServerMode.Client/RestAPI.cs index ec022606e..b1846da74 100644 --- a/src/AWS.Deploy.ServerMode.Client/RestAPI.cs +++ b/src/AWS.Deploy.ServerMode.Client/RestAPI.cs @@ -16,7 +16,100 @@ namespace AWS.Deploy.ServerMode.Client using System = global::System; [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.10.9.0 (NJsonSchema v10.4.1.0 (Newtonsoft.Json v12.0.0.0))")] - public partial class RestAPIClient + public partial interface IRestAPIClient + { + /// Start a deployment session. A session id will be generated. This session id needs to be passed in future API calls to configure and execute deployment. + /// Success + /// A server side error occurred. + System.Threading.Tasks.Task StartDeploymentSessionAsync(StartDeploymentSessionInput body); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// Start a deployment session. A session id will be generated. This session id needs to be passed in future API calls to configure and execute deployment. + /// Success + /// A server side error occurred. + System.Threading.Tasks.Task StartDeploymentSessionAsync(StartDeploymentSessionInput body, System.Threading.CancellationToken cancellationToken); + + /// Closes the deployment session. This removes any session state for the session id. + /// Success + /// A server side error occurred. + System.Threading.Tasks.Task CloseDeploymentSessionAsync(string sessionId); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// Closes the deployment session. This removes any session state for the session id. + /// Success + /// A server side error occurred. + System.Threading.Tasks.Task CloseDeploymentSessionAsync(string sessionId, System.Threading.CancellationToken cancellationToken); + + /// Set the target recipe and name for the deployment. + /// Success + /// A server side error occurred. + System.Threading.Tasks.Task SetDeploymentTargetAsync(string sessionId, SetDeploymentTargetInput body); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// Set the target recipe and name for the deployment. + /// Success + /// A server side error occurred. + System.Threading.Tasks.Task SetDeploymentTargetAsync(string sessionId, SetDeploymentTargetInput body, System.Threading.CancellationToken cancellationToken); + + /// Gets the list of compatible deployments for the session's project. The list is ordered with the first recommendation in the list being the most compatible recommendation. + /// Success + /// A server side error occurred. + System.Threading.Tasks.Task GetRecommendationsAsync(string sessionId); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// Gets the list of compatible deployments for the session's project. The list is ordered with the first recommendation in the list being the most compatible recommendation. + /// Success + /// A server side error occurred. + System.Threading.Tasks.Task GetRecommendationsAsync(string sessionId, System.Threading.CancellationToken cancellationToken); + + /// Gets the list of existing deployments that are compatible with the session's project. + /// Success + /// A server side error occurred. + System.Threading.Tasks.Task GetExistingDeploymentsAsync(string sessionId); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// Gets the list of existing deployments that are compatible with the session's project. + /// Success + /// A server side error occurred. + System.Threading.Tasks.Task GetExistingDeploymentsAsync(string sessionId, System.Threading.CancellationToken cancellationToken); + + /// Begin execution of the deployment. + /// Success + /// A server side error occurred. + System.Threading.Tasks.Task StartDeploymentAsync(string sessionId); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// Begin execution of the deployment. + /// Success + /// A server side error occurred. + System.Threading.Tasks.Task StartDeploymentAsync(string sessionId, System.Threading.CancellationToken cancellationToken); + + /// Gets the status of the deployment. + /// Success + /// A server side error occurred. + System.Threading.Tasks.Task GetDeploymentStatusAsync(string sessionId); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// Gets the status of the deployment. + /// Success + /// A server side error occurred. + System.Threading.Tasks.Task GetDeploymentStatusAsync(string sessionId, System.Threading.CancellationToken cancellationToken); + + /// Gets the health of the deployment tool. Use this API after starting the command line to see if the tool is ready to handle requests. + /// Success + /// A server side error occurred. + System.Threading.Tasks.Task HealthAsync(); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// Gets the health of the deployment tool. Use this API after starting the command line to see if the tool is ready to handle requests. + /// Success + /// A server side error occurred. + System.Threading.Tasks.Task HealthAsync(System.Threading.CancellationToken cancellationToken); + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.10.9.0 (NJsonSchema v10.4.1.0 (Newtonsoft.Json v12.0.0.0))")] + public partial class RestAPIClient : IRestAPIClient { private string _baseUrl = ""; private ServerModeHttpClient _httpClient; diff --git a/src/AWS.Deploy.ServerMode.ClientGenerator/Program.cs b/src/AWS.Deploy.ServerMode.ClientGenerator/Program.cs index 8d3a5eb91..b2177bdcf 100644 --- a/src/AWS.Deploy.ServerMode.ClientGenerator/Program.cs +++ b/src/AWS.Deploy.ServerMode.ClientGenerator/Program.cs @@ -29,6 +29,7 @@ static async Task Main(string[] args) var settings = new CSharpClientGeneratorSettings { ClassName = "RestAPIClient", + GenerateClientInterfaces = true, CSharpGeneratorSettings = { Namespace = "AWS.Deploy.ServerMode.Client",