Search in sources :

Example 1 with OracleRdbms

use of com.google.api.services.datastream.v1alpha1.model.OracleRdbms 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;
}
Also used : MysqlRdbms(com.google.api.services.datastream.v1alpha1.model.MysqlRdbms) IOException(java.io.IOException) DiscoverConnectionProfileRequest(com.google.api.services.datastream.v1alpha1.model.DiscoverConnectionProfileRequest) OracleRdbms(com.google.api.services.datastream.v1alpha1.model.OracleRdbms)

Example 2 with OracleRdbms

use of com.google.api.services.datastream.v1alpha1.model.OracleRdbms in project DataflowTemplates by GoogleCloudPlatform.

the class DataStreamClient method discoverOracleTableSchema.

/**
 * Return a {@link OracleTable} 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 OracleTable discoverOracleTableSchema(String streamName, String schemaName, String tableName, SourceConfig sourceConnProfile) throws IOException {
    DataStream.Projects.Locations.ConnectionProfiles.Discover discoverConnProfile = getDiscoverTableRequest(streamName, schemaName, tableName, sourceConnProfile);
    OracleRdbms tableResponse = discoverConnProfile.execute().getOracleRdbms();
    OracleSchema schema = tableResponse.getOracleSchemas().get(0);
    OracleTable table = schema.getOracleTables().get(0);
    return table;
}
Also used : OracleSchema(com.google.api.services.datastream.v1alpha1.model.OracleSchema) OracleTable(com.google.api.services.datastream.v1alpha1.model.OracleTable) OracleRdbms(com.google.api.services.datastream.v1alpha1.model.OracleRdbms)

Example 3 with OracleRdbms

use of com.google.api.services.datastream.v1alpha1.model.OracleRdbms in project DataflowTemplates by GoogleCloudPlatform.

the class DataStreamClient method buildOracleRdbmsForTable.

private OracleRdbms buildOracleRdbmsForTable(String schemaName, String tableName) {
    List<OracleTable> oracleTables = new ArrayList<OracleTable>();
    oracleTables.add(new OracleTable().setTableName(tableName));
    List<OracleSchema> oracleSchemas = new ArrayList<OracleSchema>();
    oracleSchemas.add(new OracleSchema().setSchemaName(schemaName).setOracleTables(oracleTables));
    OracleRdbms rdbms = new OracleRdbms().setOracleSchemas(oracleSchemas);
    return rdbms;
}
Also used : OracleTable(com.google.api.services.datastream.v1alpha1.model.OracleTable) OracleSchema(com.google.api.services.datastream.v1alpha1.model.OracleSchema) ArrayList(java.util.ArrayList) OracleRdbms(com.google.api.services.datastream.v1alpha1.model.OracleRdbms)

Aggregations

OracleRdbms (com.google.api.services.datastream.v1alpha1.model.OracleRdbms)3 OracleSchema (com.google.api.services.datastream.v1alpha1.model.OracleSchema)2 OracleTable (com.google.api.services.datastream.v1alpha1.model.OracleTable)2 DiscoverConnectionProfileRequest (com.google.api.services.datastream.v1alpha1.model.DiscoverConnectionProfileRequest)1 MysqlRdbms (com.google.api.services.datastream.v1alpha1.model.MysqlRdbms)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1