use of org.apache.inlong.manager.client.api.auth.DefaultAuthentication in project incubator-inlong by apache.
the class InlongStreamSourceTransfer method parseMySQLBinlogSource.
private static MySQLBinlogSource parseMySQLBinlogSource(BinlogSourceListResponse response) {
MySQLBinlogSource binlogSource = new MySQLBinlogSource();
binlogSource.setSourceName(response.getSourceName());
binlogSource.setHostname(response.getHostname());
binlogSource.setDataFormat(DataFormat.NONE);
binlogSource.setPort(response.getPort());
DefaultAuthentication defaultAuthentication = new DefaultAuthentication(response.getUser(), response.getPassword());
binlogSource.setAuthentication(defaultAuthentication);
binlogSource.setIncludeSchema(response.getIncludeSchema());
binlogSource.setServerTimezone(response.getServerTimezone());
binlogSource.setMonitoredDdl(response.getMonitoredDdl());
binlogSource.setTimestampFormatStandard(response.getTimestampFormatStandard());
binlogSource.setAllMigration(response.isAllMigration());
if (StringUtils.isNotBlank(response.getDatabaseWhiteList())) {
binlogSource.setDbNames(Arrays.asList(response.getDatabaseWhiteList().split(",")));
}
if (StringUtils.isNotBlank(response.getTableWhiteList())) {
binlogSource.setTableNames(Arrays.asList(response.getTableWhiteList().split(",")));
}
return binlogSource;
}
use of org.apache.inlong.manager.client.api.auth.DefaultAuthentication in project incubator-inlong by apache.
the class InlongStreamSourceTransfer method createBinlogSourceRequest.
private static BinlogSourceRequest createBinlogSourceRequest(MySQLBinlogSource binlogSource, InlongStreamInfo streamInfo) {
BinlogSourceRequest sourceRequest = new BinlogSourceRequest();
sourceRequest.setSourceName(binlogSource.getSourceName());
sourceRequest.setInlongGroupId(streamInfo.getInlongGroupId());
sourceRequest.setInlongStreamId(streamInfo.getInlongStreamId());
sourceRequest.setSourceType(binlogSource.getSourceType().name());
sourceRequest.setAgentIp(binlogSource.getAgentIp());
DefaultAuthentication authentication = binlogSource.getAuthentication();
sourceRequest.setUser(authentication.getUserName());
sourceRequest.setPassword(authentication.getPassword());
sourceRequest.setHostname(binlogSource.getHostname());
sourceRequest.setPort(binlogSource.getPort());
sourceRequest.setIncludeSchema(binlogSource.getIncludeSchema());
sourceRequest.setServerTimezone(binlogSource.getServerTimezone());
sourceRequest.setMonitoredDdl(binlogSource.getMonitoredDdl());
sourceRequest.setAllMigration(binlogSource.isAllMigration());
if (CollectionUtils.isNotEmpty(binlogSource.getDbNames())) {
String dbNames = Joiner.on(",").join(binlogSource.getDbNames());
sourceRequest.setDatabaseWhiteList(dbNames);
}
if (CollectionUtils.isNotEmpty(binlogSource.getTableNames())) {
String tableNames = Joiner.on(",").join(binlogSource.getTableNames());
sourceRequest.setTableWhiteList(tableNames);
}
sourceRequest.setSnapshotMode("initial");
sourceRequest.setIntervalMs("500");
sourceRequest.setTimestampFormatStandard(binlogSource.getTimestampFormatStandard());
return sourceRequest;
}
Aggregations