/** * Looks up and lazily creates if required a SSH host configuration for the given host alias. * The host name will be defaulted to the same hostName value for cases when the alias is the same as the actual host name */ public SshHostConfiguration sshHost(String hostName) { SshConfiguration config = getSshConfiguration(); if (config == null) { config = new SshConfiguration(); setSshConfiguration(config); } List<SshHostConfiguration> hosts = config.getHosts(); if (hosts == null) { hosts = new ArrayList<>(); config.setHosts(hosts); } return config.host(hostName); }
/** * Returns the host configuration for the given host name; lazily creating a new one if one does not exist yet */ public SshHostConfiguration host(String hostName) { SshHostConfiguration answer = getHost(hostName); if (answer == null) { answer = new SshHostConfiguration(hostName); addHost(answer); } return answer; }
public SshConfiguration fallbackRepositories(final String... fallbackRepositories) { return fallbackRepositories(Arrays.asList(fallbackRepositories)); }
if (Strings.isNullOrBlank(path)) { if (sshHosts != null) { path = sshHosts.getDefaultPath(); if (portValue == null) { if (sshHosts != null) { portValue = sshHosts.getDefaultPort(); if (Strings.isNullOrBlank(username)) { if (sshHosts != null) { username = sshHosts.getDefaultUsername(); if (Strings.isNullOrBlank(password)) { if (sshHosts != null) { password = sshHosts.getDefaultPassword(); fallbackRepositories = sshHosts.getFallbackRepositories(); if (Strings.isNullOrBlank(passPhrase)) { if (sshHosts != null) { passPhrase = sshHosts.getDefaultPassPhrase(); if (Strings.isNullOrBlank(privateKeyFile)) { if (sshHosts != null) { privateKeyFile = sshHosts.getDefaultPrivateKeyFile();
/** * Returns the ssh configuration; lazily creating one if it does not exist yet */ public SshConfiguration sshConfiguration() { SshConfiguration answer = getSshConfiguration(); if (answer == null) { answer = new SshConfiguration(); setSshConfiguration(answer); } return answer; }
/** * Returns the ssh configuration; lazily creating one if it does not exist yet */ public SshConfiguration sshConfiguration() { SshConfiguration answer = getSshConfiguration(); if (answer == null) { answer = new SshConfiguration(); setSshConfiguration(answer); } return answer; }
/** * Looks up and lazily creates if required a SSH host configuration for the given host alias. * The host name will be defaulted to the same hostName value for cases when the alias is the same as the actual host name */ public SshHostConfiguration sshHost(String hostName) { SshConfiguration config = getSshConfiguration(); if (config == null) { config = new SshConfiguration(); setSshConfiguration(config); } List<SshHostConfiguration> hosts = config.getHosts(); if (hosts == null) { hosts = new ArrayList<>(); config.setHosts(hosts); } return config.host(hostName); }
// Set up SSH public key String fullStorePath = " ~/.ssh/authorized_keys"; String sshKeyData = "you-ssh-key-data"; SshPublicKey sshPublicKey = new SshPublicKey(); sshPublicKey.setPath(fullStorePath); sshPublicKey.setKeyData(sshKeyData); // SShConfiguration ArrayList<SshPublicKey> keyList = new ArrayList<SshPublicKey>(); keyList.add(sshPublicKey); SshConfiguration sshConfig = new SshConfiguration(); sshconfig.setPublicKeys(keyList); // Linux Configuration Bool shouldDisablePasswordAuthentication = False; LinuxConfiguration linuxConfig = new LinuxConfiguration(); linuxConfig.setSsh(sshConfig); linuxConfig.setDisablePasswordAuthentication(shouldDisablePasswordAuthentication); // set your OSProfile now request.getOsProfile().setLinuxConfiguration(linuxConfig); // you code goes here
/** * Returns the host configuration for the given host name; lazily creating a new one if one does not exist yet */ public SshHostConfiguration host(String hostName) { SshHostConfiguration answer = getHost(hostName); if (answer == null) { answer = new SshHostConfiguration(hostName); addHost(answer); } return answer; }
public SshConfiguration fallbackRepositories(final String... fallbackRepositories) { return fallbackRepositories(Arrays.asList(fallbackRepositories)); }