Search in sources :

Example 6 with ApiRemoteDataContext

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);
    }
}
Also used : ApiRemoteDataContext(com.cloudera.api.swagger.model.ApiRemoteDataContext) ApiCluster(com.cloudera.api.swagger.model.ApiCluster) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) ClouderaManagerClientInitException(com.sequenceiq.cloudbreak.cm.client.ClouderaManagerClientInitException) ApiClient(com.cloudera.api.swagger.client.ApiClient) CdpResourceApi(com.cloudera.api.swagger.CdpResourceApi) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) ApiException(com.cloudera.api.swagger.client.ApiException)

Aggregations

CdpResourceApi (com.cloudera.api.swagger.CdpResourceApi)6 ApiClient (com.cloudera.api.swagger.client.ApiClient)6 ApiRemoteDataContext (com.cloudera.api.swagger.model.ApiRemoteDataContext)6 HostsResourceApi (com.cloudera.api.swagger.HostsResourceApi)4 ApiHostList (com.cloudera.api.swagger.model.ApiHostList)4 ApiHostRef (com.cloudera.api.swagger.model.ApiHostRef)4 HttpClientConfig (com.sequenceiq.cloudbreak.client.HttpClientConfig)4 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)4 ProxyConfig (com.sequenceiq.cloudbreak.dto.ProxyConfig)4 TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)4 GeneralClusterConfigs (com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs)4 Telemetry (com.sequenceiq.common.api.telemetry.model.Telemetry)4 Test (org.junit.jupiter.api.Test)4 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)4 ApiException (com.cloudera.api.swagger.client.ApiException)3 ApiCluster (com.cloudera.api.swagger.model.ApiCluster)2 ClouderaManagerClientInitException (com.sequenceiq.cloudbreak.cm.client.ClouderaManagerClientInitException)2 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 IOException (java.io.IOException)1