internal ContainerNamedPipeClientSessionTransportManager( ContainerConnectionInfo connectionInfo, Guid runspaceId, PSRemotingCryptoHelper cryptoHelper) : base(connectionInfo, runspaceId, cryptoHelper, _threadName) { if (connectionInfo == null) { throw new PSArgumentNullException("connectionInfo"); } _connectionInfo = connectionInfo; }
/// <summary> /// This constructor will be used to created a remote runspace info /// object with a auto generated name /// </summary> /// <param name="remoteRunspace">Remote runspace object for which /// the info object need to be created</param> internal PSSession(RemoteRunspace remoteRunspace) { _remoteRunspace = remoteRunspace; // Use passed in session Id, if available. if (remoteRunspace.PSSessionId != -1) { Id = remoteRunspace.PSSessionId; } else { Id = System.Threading.Interlocked.Increment(ref s_seed); remoteRunspace.PSSessionId = Id; } // Use passed in friendly name, if available. if (!string.IsNullOrEmpty(remoteRunspace.PSSessionName)) { Name = remoteRunspace.PSSessionName; } else { Name = "Runspace" + Id; remoteRunspace.PSSessionName = Name; } // WSMan session if (remoteRunspace.ConnectionInfo is WSManConnectionInfo) { ComputerType = TargetMachineType.RemoteMachine; string fullShellName = WSManConnectionInfo.ExtractPropertyAsWsManConnectionInfo <string>( remoteRunspace.ConnectionInfo, "ShellUri", string.Empty); ConfigurationName = GetDisplayShellName(fullShellName); return; } // VM session VMConnectionInfo vmConnectionInfo = remoteRunspace.ConnectionInfo as VMConnectionInfo; if (vmConnectionInfo != null) { ComputerType = TargetMachineType.VirtualMachine; ConfigurationName = vmConnectionInfo.ConfigurationName; return; } // Container session ContainerConnectionInfo containerConnectionInfo = remoteRunspace.ConnectionInfo as ContainerConnectionInfo; if (containerConnectionInfo != null) { ComputerType = TargetMachineType.Container; ConfigurationName = containerConnectionInfo.ContainerProc.ConfigurationName; return; } // SSH session SSHConnectionInfo sshConnectionInfo = remoteRunspace.ConnectionInfo as SSHConnectionInfo; if (sshConnectionInfo != null) { ComputerType = TargetMachineType.RemoteMachine; ConfigurationName = "DefaultShell"; return; } // We only support WSMan/VM/Container sessions now. Dbg.Assert(false, "Invalid Runspace"); }
internal ContainerHyperVSocketClientSessionTransportManager( ContainerConnectionInfo connectionInfo, Guid runspaceId, PSRemotingCryptoHelper cryptoHelper, Guid targetGuid) : base(runspaceId, cryptoHelper) { if (connectionInfo == null) { throw new PSArgumentNullException("connectionInfo"); } _connectionInfo = connectionInfo; _targetGuid = targetGuid; }