public interface SSHContext
SSHSession for interacting with remote hosts.| Modifier and Type | Method and Description |
|---|---|
default SSHSession |
createSSHSession(SSHKeyPair keyPair,
String host)
Creates a
SSHSession to the given host. |
default SSHSession |
createSSHSession(String host)
Creates a
SSHSession to the given host. |
SSHSession |
createSSHSession(String user,
java.util.function.Supplier<byte[]> privateKeySupplier,
String host,
int port,
Map<String,String> configs)
Creates a
SSHSession to the given host, on a specific port, and with extra sets of ssh configurations. |
default SSHKeyPair |
generate(String user)
Generates a 2048 bits RSA secure key pair for SSH operations.
|
SSHKeyPair |
generate(String user,
int bits)
Generates a RSA secure key pair for SSH operations.
|
Optional<SSHKeyPair> |
getSSHKeyPair()
Returns the
SSHKeyPair that were set earlier via the setSSHKeyPair(SSHKeyPair) method during the
Provisioner.createCluster(ProvisionerContext) time. |
void |
setSSHKeyPair(SSHKeyPair sshKeyPair)
Sets the SSH key pair for the platform to communicate with the cluster in future.
|
default SSHKeyPair generate(String user) throws KeyException
user - the user name used for SSH.SSHKeyPairKeyException - if failed to generate the key pairSSHKeyPair generate(String user, int bits) throws KeyException
user - the user name used for SSH.bits - number of bits in the RSA key. The longer it is, the more secure.SSHKeyPairKeyException - if failed to generate the key pairvoid setSSHKeyPair(SSHKeyPair sshKeyPair)
Provisioner.createCluster(ProvisionerContext) call.sshKeyPair - the SSHKeyPair to useOptional<SSHKeyPair> getSSHKeyPair()
SSHKeyPair that were set earlier via the setSSHKeyPair(SSHKeyPair) method during the
Provisioner.createCluster(ProvisionerContext) time.Optional of SSHKeyPairdefault SSHSession createSSHSession(String host) throws IOException
SSHSession to the given host. It uses the SSHKeyPair
set via the setSSHKeyPair(SSHKeyPair) method.host - hostname to ssh toSSHSessionIOException - if failed to create a new session to the hostdefault SSHSession createSSHSession(SSHKeyPair keyPair, String host) throws IOException
SSHSession to the given host.host - hostname to ssh toSSHSessionIOException - if failed to create a new session to the hostSSHSession createSSHSession(String user, java.util.function.Supplier<byte[]> privateKeySupplier, String host, int port, Map<String,String> configs) throws IOException
SSHSession to the given host, on a specific port, and with extra sets of ssh configurations.user - user name for sshprivateKeySupplier - a Supplier to private key used for sshhost - hostname to ssh toport - the port to connect toconfigs - set of extra configurationsSSHSessionIOException - if failed to create a new session to the hostCopyright © 2018 Cask Data, Inc. Licensed under the Apache License, Version 2.0.