use of com.cloudera.api.swagger.model.ApiRemoteDataContext in project cloudbreak by hortonworks.
the class ClouderaManagerSetupService method getSdxContext.
@Override
public String getSdxContext() {
Cluster cluster = stack.getCluster();
String user = cluster.getCloudbreakAmbariUser();
String password = cluster.getCloudbreakAmbariPassword();
try {
ApiClient rootClient = clouderaManagerApiClientProvider.getRootClient(stack.getGatewayPort(), user, password, clientConfig);
CdpResourceApi cdpResourceApi = clouderaManagerApiFactory.getCdpResourceApi(rootClient);
LOGGER.info("Get remote context from Datalake cluster: {}", stack.getName());
ApiRemoteDataContext remoteDataContext = cdpResourceApi.getRemoteContextByCluster(stack.getName());
return JsonUtil.writeValueAsString(remoteDataContext);
} catch (ApiException | ClouderaManagerClientInitException e) {
LOGGER.error("Error while getting remote context of Datalake cluster: {}", stack.getName(), e);
throw new ClouderaManagerOperationFailedException("Error while getting remote context of Datalake cluster", e);
} catch (JsonProcessingException e) {
LOGGER.error("Failed to serialize remote context.", e);
throw new ClouderaManagerOperationFailedException("Failed to serialize remote context.", e);
}
}
Aggregations