use of org.apache.inlong.manager.client.api.auth.TokenAuthentication in project incubator-inlong by apache.
the class InlongGroupTransfer method createPulsarExtInfo.
public static List<InlongGroupExtInfo> createPulsarExtInfo(PulsarBaseConf pulsarBaseConf) {
List<InlongGroupExtInfo> extInfos = new ArrayList<>();
if (pulsarBaseConf.getAuthentication() != null) {
Authentication authentication = pulsarBaseConf.getAuthentication();
AuthType authType = authentication.getAuthType();
AssertUtil.isTrue(authType == AuthType.TOKEN, String.format("Unsupported authentication:%s for pulsar", authType.name()));
TokenAuthentication tokenAuthentication = (TokenAuthentication) authentication;
InlongGroupExtInfo authTypeExt = new InlongGroupExtInfo();
authTypeExt.setKeyName(InlongGroupSettings.PULSAR_AUTHENTICATION_TYPE);
authTypeExt.setKeyValue(tokenAuthentication.getAuthType().toString());
extInfos.add(authTypeExt);
InlongGroupExtInfo authValue = new InlongGroupExtInfo();
authValue.setKeyName(InlongGroupSettings.PULSAR_AUTHENTICATION);
authValue.setKeyValue(tokenAuthentication.getToken());
extInfos.add(authValue);
}
if (StringUtils.isNotEmpty(pulsarBaseConf.getPulsarAdminUrl())) {
InlongGroupExtInfo pulsarAdminUrl = new InlongGroupExtInfo();
pulsarAdminUrl.setKeyName(InlongGroupSettings.PULSAR_ADMIN_URL);
pulsarAdminUrl.setKeyValue(pulsarBaseConf.getPulsarAdminUrl());
extInfos.add(pulsarAdminUrl);
}
if (StringUtils.isNotEmpty(pulsarBaseConf.getPulsarServiceUrl())) {
InlongGroupExtInfo pulsarServiceUrl = new InlongGroupExtInfo();
pulsarServiceUrl.setKeyName(InlongGroupSettings.PULSAR_SERVICE_URL);
pulsarServiceUrl.setKeyValue(pulsarBaseConf.getPulsarServiceUrl());
extInfos.add(pulsarServiceUrl);
}
return extInfos;
}
Aggregations