pub struct Session { /* private fields */ }Implementations§
Source§impl Session
impl Session
Sourcepub async fn channel_open_session(&self) -> Result<Channel<Msg>, Error>
pub async fn channel_open_session(&self) -> Result<Channel<Msg>, Error>
Returns reusable remote channel that can used as a SSH/SFTP tunnel.
This prevents direct access to private session.
Sourcepub fn load_secret_key<P: AsRef<Path>>(
secret_: P,
password: Option<&str>,
) -> Result<KeyPair, Error>
pub fn load_secret_key<P: AsRef<Path>>( secret_: P, password: Option<&str>, ) -> Result<KeyPair, Error>
Load a secret key, deciphering it with the supplied password if necessary.
Sourcepub async fn connect(
user: &str,
public_dns_name: String,
ssh_key: String,
) -> Result<Self>
pub async fn connect( user: &str, public_dns_name: String, ssh_key: String, ) -> Result<Self>
Connect to remote instance via SSH.
The public DNS name is the emphemeral host address generated when an EC2 instance starts.
Sourcepub async fn upload(
&self,
src: Option<String>,
dst: Option<String>,
) -> Result<()>
pub async fn upload( &self, src: Option<String>, dst: Option<String>, ) -> Result<()>
Upload files within src to dst directory using SFTP.
If dst is not specified, files will uploaded to $HOME/{cwd}.
The {cwd} folder will be created by default in this use case.
Panics if dst is not a directory.
Auto Trait Implementations§
impl Freeze for Session
impl RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnwindSafe for Session
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.