use of com.google.api.services.datastream.v1alpha1.model.DiscoverConnectionProfileRequest 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;
}
Aggregations