Google is committed to advancing racial equity for Black communities. See how.

GceRemoteCmdFormatter

public class GceRemoteCmdFormatter
extends Object

java.lang.Object
   ↳ com.android.tradefed.device.cloud.GceRemoteCmdFormatter


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

Summary

Nested classes

enum GceRemoteCmdFormatter.ScpMode

SCP can be used to push or pull file depending of the structure of the args. 

Public constructors

GceRemoteCmdFormatter()

Public methods

static getScpCommand(File sshKey, 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 getSshCommand(File sshKey, 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  getScpCommand (File sshKey, 
                 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 ERROR(/File).

extraOptions : 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
a list representing the scp command for a gce device.

getSshCommand

public static  getSshCommand (File sshKey, 
                 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 ERROR(/File).

extraOptions : 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
a list representing the ssh command for a gce device.