-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding documentation for the public interfaces
- Loading branch information
Showing
13 changed files
with
184 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,71 @@ | ||
namespace WinRMSharp | ||
{ | ||
/// <summary> | ||
/// Encapsulates WinRM network protocol for sending/receiving SOAP requests/responses necessary | ||
/// for executing remote commands. | ||
/// </summary> | ||
public interface IProtocol | ||
{ | ||
/// <summary> | ||
/// Network transport used for sending/receiving SOAP requests/responses. | ||
/// </summary> | ||
ITransport Transport { get; } | ||
|
||
/// <summary> | ||
/// Open a shell instance on the destination host. | ||
/// </summary> | ||
/// <param name="inputStream">Input streams to open.</param> | ||
/// <param name="outputStream">Output streams to open.</param> | ||
/// <param name="workingDirectory">Working directory of shell.</param> | ||
/// <param name="envVars">Environment variables of shell.</param> | ||
/// <param name="idleTimeout">Time length before shell is closed, if unused.</param> | ||
/// <returns>Identifier for opened shell.</returns> | ||
Task<string> OpenShell(string inputStream = "stdin", string outputStream = "stdout stderr", string? workingDirectory = null, Dictionary<string, string>? envVars = null, TimeSpan? idleTimeout = null); | ||
|
||
/// <summary> | ||
/// Run a command in an opened shell on the destination host. | ||
/// </summary> | ||
/// <param name="shellId">The shell id on the remote machine. See <see cref="OpenShell"/>.</param> | ||
/// <param name="command">The command id on the remote machine. See <see cref="RunCommand"/>.</param> | ||
/// <param name="args">Array of arguments for the command.</param> | ||
/// <returns>Identifier for the executing command.</returns> | ||
Task<string> RunCommand(string shellId, string command, string[]? args = null); | ||
|
||
/// <summary> | ||
/// Send input to a command executing in a shell. | ||
/// </summary> | ||
/// <param name="shellId">The shell id on the remote machine. See <see cref="OpenShell"/>.</param> | ||
/// <param name="command">The command id on the remote machine. See <see cref="RunCommand"/>.</param> | ||
/// <param name="input">Input text to send.</param> | ||
/// <param name="end">Boolean flag to indicate to close the stdin stream.</param> | ||
Task SendCommandInput(string shellId, string commandId, string input, bool end = false); | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <param name="shellId">The shell id on the remote machine. See <see cref="OpenShell"/>.</param> | ||
/// <param name="command">The command id on the remote machine. See <see cref="RunCommand"/>.</param> | ||
Task<CommandState> PollCommandState(string shellId, string commandId); | ||
|
||
/// <summary> | ||
/// Gets the latest state of a command executing in a shell. | ||
/// </summary> | ||
/// <param name="shellId">The shell id on the remote machine. See <see cref="OpenShell"/>.</param> | ||
/// <param name="command">The command id on the remote machine. See <see cref="RunCommand"/>.</param> | ||
/// <returns>State of a executing command.</returns> | ||
Task<CommandState> GetCommandState(string shellId, string commandId); | ||
|
||
/// <summary> | ||
/// Cleans up an executed command on the destination host. | ||
/// </summary> | ||
/// <param name="shellId">The shell id on the remote machine. See <see cref="OpenShell"/>.</param> | ||
/// <param name="command">The command id on the remote machine. See <see cref="RunCommand"/>.</param> | ||
Task CloseCommand(string shellId, string commandId); | ||
|
||
/// <summary> | ||
/// Close a shell on the destination host. | ||
/// </summary> | ||
/// <param name="shellId">The shell id on the remote machine. See <see cref="OpenShell"/>.</param> | ||
Task CloseShell(string shellId); | ||
Task CleanupCommand(string shellId, string commandId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,18 @@ | ||
namespace WinRMSharp | ||
{ | ||
/// <summary> | ||
/// Encapsulates network transport for sending/receiving SOAP requests/responses | ||
/// over WinRM. | ||
/// </summary> | ||
public interface ITransport | ||
{ | ||
/// <summary> | ||
/// Sends an XML message to the destination host. | ||
/// </summary> | ||
/// <param name="message">XML request message to send</param> | ||
/// <returns>XML response message</returns> | ||
/// <exception cref="InvalidCredentialException">Thrown when provided credentials are invalid.</exception> | ||
/// <exception cref="TransportException">Thrown when response returns non success status code [200,299).</exception> | ||
Task<string> Send(string message); | ||
} | ||
} |
Oops, something went wrong.