GceRemoteCmdFormatter

public class GceRemoteCmdFormatter
extends Object

java.lang.Object
   ↳ com.android.tradefed.util.GceRemoteCmdFormatter


Utility class to format commands to reach a remote gce device.

Summary

Public constructors

GceRemoteCmdFormatter()

Public methods

static List<String> getScpCommand(File sshKey, List<String> extraOptions, String user, String hostName, String remoteFile, String localFile, GceRemoteCmdFormatter.ScpMode mode)

Utility to create a scp command to fetch a file from a remote gce device.

static List<String> getSshCommand(File sshKey, List<String> extraOptions, String user, String hostName, String... command)

Utility to create a ssh command for a gce device based on some parameters.

Public constructors

GceRemoteCmdFormatter

public GceRemoteCmdFormatter ()

Public methods

getScpCommand

public static List<String> getScpCommand (File sshKey, 
                List<String> extraOptions, 
                String user, 
                String hostName, 
                String remoteFile, 
                String localFile, 
                GceRemoteCmdFormatter.ScpMode mode)

Utility to create a scp command to fetch a file from a remote gce device.

Parameters
sshKey File: the ssh key File.

extraOptions List: a List of String that can be added for extra ssh options. can be null.

user String

hostName String: the hostname where to connect to the gce device.

remoteFile String: the file to be fetched on the remote gce device.

localFile String: the local file where to put the remote file.

mode GceRemoteCmdFormatter.ScpMode: whether we are pushing the local file to the remote or pulling the remote

Returns
List<String> a list representing the scp command for a gce device.

getSshCommand

public static List<String> getSshCommand (File sshKey, 
                List<String> extraOptions, 
                String user, 
                String hostName, 
                String... command)

Utility to create a ssh command for a gce device based on some parameters.

Parameters
sshKey File: the ssh key File.

extraOptions List: a List of String that can be added for extra ssh options. can be null.

user String

hostName String: the hostname where to connect to the gce device.

command String: the actual command to run on the gce device.

Returns
List<String> a list representing the ssh command for a gce device.