use of com.google.api.services.datastream.v1alpha1.model.MysqlRdbms in project DataflowTemplates by GoogleCloudPlatform.
the class DataStreamClient method getDiscoverTableRequest.
private DataStream.Projects.Locations.ConnectionProfiles.Discover getDiscoverTableRequest(String streamName, String schemaName, String tableName, SourceConfig sourceConnProfile) throws IOException {
String sourceConnProfileName = sourceConnProfile.getSourceConnectionProfileName();
String parent = getParentFromConnectionProfileName(sourceConnProfileName);
DiscoverConnectionProfileRequest discoverRequest = new DiscoverConnectionProfileRequest().setConnectionProfileName(sourceConnProfileName);
if (sourceConnProfile.getMysqlSourceConfig() != null) {
MysqlRdbms mysqlRdbms = buildMysqlRdbmsForTable(schemaName, tableName);
discoverRequest = discoverRequest.setMysqlRdbms(mysqlRdbms);
} else if (sourceConnProfile.getOracleSourceConfig() != null) {
OracleRdbms oracleRdbms = buildOracleRdbmsForTable(schemaName, tableName);
discoverRequest = discoverRequest.setOracleRdbms(oracleRdbms);
} else {
throw new IOException("Source Connection Profile Type Not Supported");
}
DataStream.Projects.Locations.ConnectionProfiles.Discover discoverConnProfile = getDataStream().projects().locations().connectionProfiles().discover(parent, discoverRequest);
this.datastreamRpcs.inc();
return discoverConnProfile;
}
use of com.google.api.services.datastream.v1alpha1.model.MysqlRdbms in project DataflowTemplates by GoogleCloudPlatform.
the class DataStreamClient method discoverMysqlTableSchema.
/**
* Return a {@link MysqlTable} object with schema and PK information.
*
* @param streamName A fully qualified Stream name (ie. projects/my-project/stream/my-stream)
* @param schemaName The name of the schema for the table being discovered.
* @param tableName The name of the table to discover.
* @param sourceConnProfile The SourceConfig connection profile to be discovered.
*/
public MysqlTable discoverMysqlTableSchema(String streamName, String schemaName, String tableName, SourceConfig sourceConnProfile) throws IOException {
DataStream.Projects.Locations.ConnectionProfiles.Discover discoverConnProfile = getDiscoverTableRequest(streamName, schemaName, tableName, sourceConnProfile);
MysqlRdbms tableResponse = discoverConnProfile.execute().getMysqlRdbms();
MysqlDatabase schema = tableResponse.getMysqlDatabases().get(0);
MysqlTable table = schema.getMysqlTables().get(0);
return table;
}
use of com.google.api.services.datastream.v1alpha1.model.MysqlRdbms in project DataflowTemplates by GoogleCloudPlatform.
the class DataStreamClient method buildMysqlRdbmsForTable.
private MysqlRdbms buildMysqlRdbmsForTable(String databaseName, String tableName) {
List<MysqlTable> mysqlTables = new ArrayList<MysqlTable>();
mysqlTables.add(new MysqlTable().setTableName(tableName));
List<MysqlDatabase> mysqlDatabases = new ArrayList<MysqlDatabase>();
mysqlDatabases.add(new MysqlDatabase().setDatabaseName(databaseName).setMysqlTables(mysqlTables));
MysqlRdbms rdbms = new MysqlRdbms().setMysqlDatabases(mysqlDatabases);
return rdbms;
}
Aggregations