use of com.sequenceiq.sdx.api.model.SdxClusterResponse in project cloudbreak by hortonworks.
the class SdxController method resize.
@Override
@CheckPermissionByResourceName(action = AuthorizationResourceAction.RESIZE_DATALAKE)
public SdxClusterResponse resize(@ResourceName String name, SdxClusterResizeRequest resizeSdxClusterRequest) {
String userCrn = ThreadBasedUserCrnProvider.getUserCrn();
Pair<SdxCluster, FlowIdentifier> result = sdxService.resizeSdx(userCrn, name, resizeSdxClusterRequest);
SdxCluster sdxCluster = result.getLeft();
metricService.incrementMetricCounter(MetricType.EXTERNAL_SDX_REQUESTED, sdxCluster);
SdxClusterResponse sdxClusterResponse = sdxClusterConverter.sdxClusterToResponse(sdxCluster);
sdxClusterResponse.setName(sdxCluster.getClusterName());
sdxClusterResponse.setFlowIdentifier(result.getRight());
return sdxClusterResponse;
}
use of com.sequenceiq.sdx.api.model.SdxClusterResponse in project cloudbreak by hortonworks.
the class SdxInternalController method create.
@Override
@CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_DATALAKE)
public SdxClusterResponse create(String name, @Valid SdxInternalClusterRequest createSdxClusterRequest) {
String userCrn = ThreadBasedUserCrnProvider.getUserCrn();
Pair<SdxCluster, FlowIdentifier> result = sdxService.createSdx(userCrn, name, createSdxClusterRequest, createSdxClusterRequest.getStackV4Request());
SdxCluster sdxCluster = result.getLeft();
metricService.incrementMetricCounter(MetricType.INTERNAL_SDX_REQUESTED, sdxCluster);
SdxClusterResponse sdxClusterResponse = sdxClusterConverter.sdxClusterToResponse(sdxCluster);
sdxClusterResponse.setName(sdxCluster.getClusterName());
sdxClusterResponse.setFlowIdentifier(result.getRight());
return sdxClusterResponse;
}
use of com.sequenceiq.sdx.api.model.SdxClusterResponse in project cloudbreak by hortonworks.
the class StackToTemplatePreparationObjectConverter method decorateDatalakeView.
private void decorateDatalakeView(Stack source, TemplatePreparationObject.Builder builder) {
DatalakeView datalakeView = null;
if (StringUtils.isNotEmpty(source.getEnvironmentCrn()) && StackType.WORKLOAD.equals(source.getType())) {
List<SdxClusterResponse> datalakes = sdxClientService.getByEnvironmentCrn(source.getEnvironmentCrn());
if (!datalakes.isEmpty()) {
datalakeView = new DatalakeView(datalakes.get(0).getRangerRazEnabled());
}
}
builder.withDataLakeView(datalakeView);
}
use of com.sequenceiq.sdx.api.model.SdxClusterResponse in project cloudbreak by hortonworks.
the class SdxClusterConverter method sdxClusterToResponse.
public SdxClusterResponse sdxClusterToResponse(SdxCluster sdxCluster) {
SdxClusterResponse sdxClusterResponse = new SdxClusterResponse();
SdxStatusEntity actualStatusForSdx = measure(() -> sdxStatusService.getActualStatusForSdx(sdxCluster), LOGGER, "Fetching SDX status took {}ms from DB. Name: [{}]", sdxCluster.getClusterName());
if (actualStatusForSdx != null && actualStatusForSdx.getStatus() != null) {
sdxClusterResponse.setStatus(SdxClusterStatusResponse.valueOf(actualStatusForSdx.getStatus().name()));
sdxClusterResponse.setStatusReason(actualStatusForSdx.getStatusReason());
}
sdxClusterResponse.setRuntime(sdxCluster.getRuntime());
sdxClusterResponse.setName(sdxCluster.getClusterName());
sdxClusterResponse.setCrn(sdxCluster.getCrn());
sdxClusterResponse.setClusterShape(sdxCluster.getClusterShape());
sdxClusterResponse.setEnvironmentName(sdxCluster.getEnvName());
sdxClusterResponse.setEnvironmentCrn(sdxCluster.getEnvCrn());
sdxClusterResponse.setStackCrn(sdxCluster.getStackCrn());
sdxClusterResponse.setCreated(sdxCluster.getCreated());
sdxClusterResponse.setCloudStorageBaseLocation(sdxCluster.getCloudStorageBaseLocation());
sdxClusterResponse.setCloudStorageFileSystemType(sdxCluster.getCloudStorageFileSystemType());
sdxClusterResponse.setDatabaseServerCrn(sdxCluster.getDatabaseCrn());
sdxClusterResponse.setRangerRazEnabled(sdxCluster.isRangerRazEnabled());
sdxClusterResponse.setTags(getTags(sdxCluster.getTags()));
sdxClusterResponse.setCertExpirationState(sdxCluster.getCertExpirationState());
sdxClusterResponse.setSdxClusterServiceVersion(sdxCluster.getSdxClusterServiceVersion());
sdxClusterResponse.setDetached(sdxCluster.isDetached());
sdxClusterResponse.setEnableMultiAz(sdxCluster.isEnableMultiAz());
sdxClusterResponse.setDatabaseEngineVersion(sdxCluster.getDatabaseEngineVersion());
return sdxClusterResponse;
}
use of com.sequenceiq.sdx.api.model.SdxClusterResponse in project cloudbreak by hortonworks.
the class SdxController method create.
@Override
@CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_DATALAKE)
public SdxClusterResponse create(String name, @Valid SdxCustomClusterRequest createSdxClusterRequest) {
String userCrn = ThreadBasedUserCrnProvider.getUserCrn();
Pair<SdxCluster, FlowIdentifier> result = sdxService.createSdx(userCrn, name, createSdxClusterRequest);
SdxCluster sdxCluster = result.getLeft();
metricService.incrementMetricCounter(MetricType.CUSTOM_SDX_REQUESTED, sdxCluster);
SdxClusterResponse sdxClusterResponse = sdxClusterConverter.sdxClusterToResponse(sdxCluster);
sdxClusterResponse.setName(sdxCluster.getClusterName());
sdxClusterResponse.setFlowIdentifier(result.getRight());
return sdxClusterResponse;
}
Aggregations