UntypedItem untypedItem = client.getItemUntyped(key, Format.XML);
InetAddress sshAddress = findSshAddress(client, untypedItem);
ClientAction action = null;
if (sshAddress != null) {
String user = "root";
ProjectId project = key.getProject();
if (project == null) {
project = client.getProject();
}
if (project == null) {
throw new CliException("Cannot determine project");
}
String projectKey = project.getKey();
String serviceKey = "service-" + key.getServiceType().getKey();
File sshKey = IoUtils.resolve("~/.credentials/ssh/" + projectKey + "/" + serviceKey);
// Hmmm... user? key?
action = new ClientAction(ClientAction.ClientActionType.SSH, user + "@" + sshAddress.getHostAddress(),
sshKey.getAbsolutePath());
}
return action;
}