GoogleApiClientUtil

public class GoogleApiClientUtil
extends GoogleApiClientUtilBase

java.lang.Object
   ↳ com.android.tradefed.util.gcs.GoogleApiClientUtilBase
     ↳ com.android.tradefed.util.GoogleApiClientUtil


Utils for create Google API client.

Summary

Public constructors

GoogleApiClientUtil()

Public methods

static Credentials createCredential( scopes, File primaryKeyFile, String hostOptionKeyFileName, File... backupKeyFiles)

Try to create credential with different key files or from local host.

static Credentials createCredential( scopes, boolean useCredentialFactory, File primaryKeyFile, String hostOptionKeyFileName, File... backupKeyFiles)

Try to create credential with different key files or from local host.

Public constructors

GoogleApiClientUtil

public GoogleApiClientUtil ()

Public methods

createCredential

public static Credentials createCredential ( scopes, 
                File primaryKeyFile, 
                String hostOptionKeyFileName, 
                File... backupKeyFiles)

Try to create credential with different key files or from local host.

1. If primaryKeyFile is set, try to use it to create credential. 2. Try to get corresponding key files from HostOptions. 3. Try to use backup key files. 4. Use local default credential.

Parameters
scopes : scopes for the credential.

primaryKeyFile File: the primary json key file; it can be null.

hostOptionKeyFileName String: HostOptions'service-account-json-key-file option's key; it can be null.

backupKeyFiles File: backup key files.

Returns
Credentials a Credential

Throws
IOException
GeneralSecurityException

createCredential

public static Credentials createCredential ( scopes, 
                boolean useCredentialFactory, 
                File primaryKeyFile, 
                String hostOptionKeyFileName, 
                File... backupKeyFiles)

Try to create credential with different key files or from local host.

1. Use ICredentialFactory if useCredentialFactory is true and a ICredentialFactory is configured. If primaryKeyFile is set, try to use it to create credential. 2. Try to get corresponding key files from HostOptions. 3. Try to use backup key files. 4. Use local default credential.

Parameters
scopes : scopes for the credential.

useCredentialFactory boolean: use credential factory if it's configured.

primaryKeyFile File: the primary json key file; it can be null.

hostOptionKeyFileName String: HostOptions'service-account-json-key-file option's key; it can be null.

backupKeyFiles File: backup key files.

Returns
Credentials a Credential

Throws
IOException
GeneralSecurityException