Skip to content

Commit

Permalink
feat: Generate interfaces for server mode clients
Browse files Browse the repository at this point in the history
  • Loading branch information
normj committed May 25, 2021
1 parent c2799ce commit 5906a2b
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,20 @@

namespace AWS.Deploy.ServerMode.Client
{
public class DeploymentCommunicationClient : IDisposable
public interface IDeploymentCommunicationClient : IDisposable
{
Action<string>? ReceiveLogDebugLine { get; set; }

Action<string>? ReceiveLogErrorMessageLine { get; set; }

Action<string>? ReceiveLogMessageLineAction { get; set; }

Action<string>? ReceiveLogAllLogAction { get; set; }

Task JoinSession(string sessionId);
}

public class DeploymentCommunicationClient : IDeploymentCommunicationClient
{
private bool _disposedValue;

Expand Down
95 changes: 94 additions & 1 deletion src/AWS.Deploy.ServerMode.Client/RestAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
/// <summary>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.</summary>
/// <returns>Success</returns>
/// <exception cref="ApiException">A server side error occurred.</exception>
System.Threading.Tasks.Task<StartDeploymentSessionOutput> StartDeploymentSessionAsync(StartDeploymentSessionInput body);

/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <summary>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.</summary>
/// <returns>Success</returns>
/// <exception cref="ApiException">A server side error occurred.</exception>
System.Threading.Tasks.Task<StartDeploymentSessionOutput> StartDeploymentSessionAsync(StartDeploymentSessionInput body, System.Threading.CancellationToken cancellationToken);

/// <summary>Closes the deployment session. This removes any session state for the session id.</summary>
/// <returns>Success</returns>
/// <exception cref="ApiException">A server side error occurred.</exception>
System.Threading.Tasks.Task CloseDeploymentSessionAsync(string sessionId);

/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <summary>Closes the deployment session. This removes any session state for the session id.</summary>
/// <returns>Success</returns>
/// <exception cref="ApiException">A server side error occurred.</exception>
System.Threading.Tasks.Task CloseDeploymentSessionAsync(string sessionId, System.Threading.CancellationToken cancellationToken);

/// <summary>Set the target recipe and name for the deployment.</summary>
/// <returns>Success</returns>
/// <exception cref="ApiException">A server side error occurred.</exception>
System.Threading.Tasks.Task SetDeploymentTargetAsync(string sessionId, SetDeploymentTargetInput body);

/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <summary>Set the target recipe and name for the deployment.</summary>
/// <returns>Success</returns>
/// <exception cref="ApiException">A server side error occurred.</exception>
System.Threading.Tasks.Task SetDeploymentTargetAsync(string sessionId, SetDeploymentTargetInput body, System.Threading.CancellationToken cancellationToken);

/// <summary>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.</summary>
/// <returns>Success</returns>
/// <exception cref="ApiException">A server side error occurred.</exception>
System.Threading.Tasks.Task<GetRecommendationsOutput> GetRecommendationsAsync(string sessionId);

/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <summary>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.</summary>
/// <returns>Success</returns>
/// <exception cref="ApiException">A server side error occurred.</exception>
System.Threading.Tasks.Task<GetRecommendationsOutput> GetRecommendationsAsync(string sessionId, System.Threading.CancellationToken cancellationToken);

/// <summary>Gets the list of existing deployments that are compatible with the session's project.</summary>
/// <returns>Success</returns>
/// <exception cref="ApiException">A server side error occurred.</exception>
System.Threading.Tasks.Task<GetExistingDeploymentsOutput> GetExistingDeploymentsAsync(string sessionId);

/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <summary>Gets the list of existing deployments that are compatible with the session's project.</summary>
/// <returns>Success</returns>
/// <exception cref="ApiException">A server side error occurred.</exception>
System.Threading.Tasks.Task<GetExistingDeploymentsOutput> GetExistingDeploymentsAsync(string sessionId, System.Threading.CancellationToken cancellationToken);

/// <summary>Begin execution of the deployment.</summary>
/// <returns>Success</returns>
/// <exception cref="ApiException">A server side error occurred.</exception>
System.Threading.Tasks.Task StartDeploymentAsync(string sessionId);

/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <summary>Begin execution of the deployment.</summary>
/// <returns>Success</returns>
/// <exception cref="ApiException">A server side error occurred.</exception>
System.Threading.Tasks.Task StartDeploymentAsync(string sessionId, System.Threading.CancellationToken cancellationToken);

/// <summary>Gets the status of the deployment.</summary>
/// <returns>Success</returns>
/// <exception cref="ApiException">A server side error occurred.</exception>
System.Threading.Tasks.Task<GetDeploymentStatusOutput> GetDeploymentStatusAsync(string sessionId);

/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <summary>Gets the status of the deployment.</summary>
/// <returns>Success</returns>
/// <exception cref="ApiException">A server side error occurred.</exception>
System.Threading.Tasks.Task<GetDeploymentStatusOutput> GetDeploymentStatusAsync(string sessionId, System.Threading.CancellationToken cancellationToken);

/// <summary>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.</summary>
/// <returns>Success</returns>
/// <exception cref="ApiException">A server side error occurred.</exception>
System.Threading.Tasks.Task<HealthStatusOutput> HealthAsync();

/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <summary>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.</summary>
/// <returns>Success</returns>
/// <exception cref="ApiException">A server side error occurred.</exception>
System.Threading.Tasks.Task<HealthStatusOutput> 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;
Expand Down
1 change: 1 addition & 0 deletions src/AWS.Deploy.ServerMode.ClientGenerator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ static async Task Main(string[] args)
var settings = new CSharpClientGeneratorSettings
{
ClassName = "RestAPIClient",
GenerateClientInterfaces = true,
CSharpGeneratorSettings =
{
Namespace = "AWS.Deploy.ServerMode.Client",
Expand Down

0 comments on commit 5906a2b

Please sign in to comment.