public final class GCPUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
PROJECT_ID |
static String |
SERVICE_ACCOUNT_KEYFILE |
| Modifier and Type | Method and Description |
|---|---|
static com.google.cloud.bigquery.BigQuery |
getBigQueryService(ConnectionMeta connection)
Create and return
BigQuery based on the credentials and project information provided in the connection |
static String |
getProjectId(ConnectionMeta connection)
Get the project id for the connection
|
static com.google.cloud.spanner.Spanner |
getSpannerService(ConnectionMeta connection)
Create and return
Spanner based on the credentials and project information provided in the connection |
static com.google.cloud.storage.Storage |
getStorageService(ConnectionMeta connection)
Create and return
Storage based on the credentials and project information provided in the connection |
static com.google.auth.oauth2.ServiceAccountCredentials |
loadLocalFile(String path) |
static void |
validateProjectCredentials(ConnectionMeta connection)
Validates that the project and credentials are either explicitly set in the connection or are available through
the environment.
|
public static final String PROJECT_ID
public static final String SERVICE_ACCOUNT_KEYFILE
public static com.google.auth.oauth2.ServiceAccountCredentials loadLocalFile(String path) throws IOException
IOExceptionpublic static com.google.cloud.storage.Storage getStorageService(ConnectionMeta connection) throws IOException
Storage based on the credentials and project information provided in the connectionIOExceptionpublic static com.google.cloud.bigquery.BigQuery getBigQueryService(ConnectionMeta connection) throws IOException
BigQuery based on the credentials and project information provided in the connectionIOExceptionpublic static com.google.cloud.spanner.Spanner getSpannerService(ConnectionMeta connection) throws IOException
Spanner based on the credentials and project information provided in the connectionIOExceptionpublic static String getProjectId(ConnectionMeta connection)
public static void validateProjectCredentials(ConnectionMeta connection)
connection - the connection to validateIllegalArgumentException - if the project or credentials are not availableCopyright © 2020 CDAP Licensed under the Apache License, Version 2.0.