public DockerConnection(DockerContainerTransportSettings settings, Connection outerConnection, string name) : base(outerConnection, name) { _settings = settings; _containerName = settings.ContainerName; _dockerExecutionManager = new DockerExecutionManager(settings, outerConnection); }
public DockerExecSettings(DockerContainerTransportSettings settings, string command, bool runInShell, bool makeInteractive = true) : base(settings) { Debug.Assert(!string.IsNullOrWhiteSpace(command), "Exec command cannot be null"); _runInShell = runInShell; _commandToExecute = command; _makeInteractive = makeInteractive; }
internal static bool TryConvertConnectionStringToSettings(string connectionString, out DockerContainerTransportSettings settings, out Connection remoteConnection) { ThreadHelper.ThrowIfNotOnUIThread(); remoteConnection = null; settings = null; string containerName = string.Empty; string hostName = string.Empty; bool invalidString = false; // Assume format is <containername>;ssh=<sshconnection>;host=<dockerhostvalue> or some mixture string[] connectionStrings = connectionString.Split(Separator); if (connectionStrings.Length <= 3 && connectionStrings.Length > 0) { Regex SshRegex = new Regex(SshPrefixRegex); Regex dockerHostRegex = new Regex(DockerHostPrefixRegex); foreach (var item in connectionStrings) { string segment = item.Trim(' '); if (SshRegex.IsMatch(segment)) { Match match = SshRegex.Match(segment); remoteConnection = ConnectionManager.GetSSHConnection(segment.Substring(match.Length)); } else if (dockerHostRegex.IsMatch(segment)) { Match match = dockerHostRegex.Match(segment); hostName = segment.Substring(match.Length); } else if (segment.Contains("=")) { invalidString = true; } else { if (!string.IsNullOrWhiteSpace(containerName)) { Debug.Fail("containerName should be empty"); invalidString = true; } else { containerName = segment; } } } } if (!string.IsNullOrWhiteSpace(containerName) && !invalidString) { settings = new DockerContainerTransportSettings(hostName, containerName, remoteConnection != null); return(true); } return(false); }
private ICommandRunner GetCommandRunner(DockerContainerTransportSettings settings, bool handleRawOutput = false) { if (OuterConnection == null) { return(LocalCommandRunner.CreateInstance(handleRawOutput, settings)); } else { return(new RemoteCommandRunner(settings, OuterConnection, handleRawOutput)); } }
public DockerCopySettings(DockerContainerTransportSettings settings, string sourcePath, string destinationPath) : base(settings) { _sourcePath = sourcePath; _destinationPath = destinationPath; }
public DockerContainerTransportSettings(DockerContainerTransportSettings settings) : base(settings) { ContainerName = settings.ContainerName; }
public DockerExecutionManager(DockerContainerTransportSettings baseSettings, Connection outerConnection) { _baseSettings = baseSettings; _outerConnection = outerConnection; }