예제 #1
0
        /// <summary>
        /// Gets a <see cref="SshClientWrapper"/> for which the Connect() method has NOT been called.
        /// </summary>
        public static SshClientWrapper GetUnconnectedSshClientWrapper(this AwsEc2ServerSecrets awsEc2ServerSecrets)
        {
            var connectionInfo = awsEc2ServerSecrets.GetConnectionInfo();

            var clientWrapper = new SshClientWrapper(connectionInfo);

            return(clientWrapper);
        }
예제 #2
0
        /// <summary>
        /// Gets a connected <see cref="SshClientWrapper"/>.
        /// </summary>
        public static SshClientWrapper GetConnectedSshClientWrapper(this AwsEc2ServerSecrets awsEc2ServerSecrets)
        {
            var clientWrapper = awsEc2ServerSecrets.GetUnconnectedSshClientWrapper();

            clientWrapper.SshClient.Connect();

            return(clientWrapper);
        }
예제 #3
0
        public static ConnectionInfo GetConnectionInfo(this AwsEc2ServerSecrets awsEc2ServerSecrets)
        {
            var connectionInfo = Utilities.GetConnectionInfo(
                awsEc2ServerSecrets.HostUrl,
                awsEc2ServerSecrets.UserID,
                awsEc2ServerSecrets.Password,
                awsEc2ServerSecrets.PrivateKeyFilePath);

            return(connectionInfo);
        }
예제 #4
0
        public static AwsEc2ServerSecrets GetAwsEc2ServerSecrets(this AwsEc2ServerSecretsSerialization serialization, string hostFriendlyName)
        {
            var hostConnectionDefinition = serialization.HostConnectionsByFriendlyName[hostFriendlyName];

            var userAuthentication = serialization.UserAuthenticationsByFriendlyName[hostConnectionDefinition.UserAuthenticationName];

            var serverSecrets = new AwsEc2ServerSecrets()
            {
                HostUrl            = hostConnectionDefinition.HostURL,
                UserID             = userAuthentication.UserID,
                Password           = userAuthentication.Password,
                PrivateKeyFilePath = userAuthentication.PrivateKeyFilePath,
            };

            return(serverSecrets);
        }
예제 #5
0
        /// <summary>
        /// Gets a connected <see cref="SshClientWrapper"/>.
        /// </summary>
        public static SshClientWrapper GetSshClientWrapper(this AwsEc2ServerSecrets awsEc2ServerSecrets)
        {
            var output = awsEc2ServerSecrets.GetConnectedSshClientWrapper();

            return(output);
        }