Search in sources :

Example 31 with SdxClusterResponse

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;
}
Also used : SdxCluster(com.sequenceiq.datalake.entity.SdxCluster) FlowIdentifier(com.sequenceiq.flow.api.model.FlowIdentifier) SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse) CheckPermissionByResourceName(com.sequenceiq.authorization.annotation.CheckPermissionByResourceName)

Example 32 with 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;
}
Also used : SdxCluster(com.sequenceiq.datalake.entity.SdxCluster) FlowIdentifier(com.sequenceiq.flow.api.model.FlowIdentifier) SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse) CheckPermissionByAccount(com.sequenceiq.authorization.annotation.CheckPermissionByAccount)

Example 33 with 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);
}
Also used : DatalakeView(com.sequenceiq.cloudbreak.template.views.DatalakeView) SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse)

Example 34 with SdxClusterResponse

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;
}
Also used : SdxStatusEntity(com.sequenceiq.datalake.entity.SdxStatusEntity) SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse)

Example 35 with 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;
}
Also used : SdxCluster(com.sequenceiq.datalake.entity.SdxCluster) FlowIdentifier(com.sequenceiq.flow.api.model.FlowIdentifier) SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse) CheckPermissionByAccount(com.sequenceiq.authorization.annotation.CheckPermissionByAccount)

Aggregations

SdxClusterResponse (com.sequenceiq.sdx.api.model.SdxClusterResponse)54 Test (org.junit.jupiter.api.Test)22 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)13 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)12 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)12 ValidationResult (com.sequenceiq.cloudbreak.validation.ValidationResult)10 TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)8 SdxCluster (com.sequenceiq.datalake.entity.SdxCluster)8 Test (org.junit.Test)8 TelemetryRequest (com.sequenceiq.common.api.telemetry.request.TelemetryRequest)7 ArrayList (java.util.ArrayList)7 CloudStorageRequest (com.sequenceiq.common.api.cloudstorage.CloudStorageRequest)5 FlowIdentifier (com.sequenceiq.flow.api.model.FlowIdentifier)5 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)5 SdxClientService (com.sequenceiq.cloudbreak.service.datalake.SdxClientService)4 LoggingResponse (com.sequenceiq.common.api.telemetry.response.LoggingResponse)4 CompactRegionResponse (com.sequenceiq.environment.api.v1.environment.model.response.CompactRegionResponse)4 Set (java.util.Set)4 StackV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response)3 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)3