Search in sources :

Example 1 with DiagnosticsCollectionRequest

use of com.sequenceiq.cloudbreak.api.endpoint.v4.diagnostics.model.DiagnosticsCollectionRequest in project cloudbreak by hortonworks.

the class DiagnosticsParamsConverter method convertToRequest.

public DiagnosticsCollectionRequest convertToRequest(Map<String, Object> props) {
    DiagnosticsCollectionRequest request = new DiagnosticsCollectionRequest();
    request.setDestination(Optional.ofNullable(props.get(PARAM_DESTINATION)).map(v -> DiagnosticsDestination.valueOf(v.toString())).orElse(null));
    request.setStackCrn(Optional.ofNullable(props.get(PARAMS_STACK_CRN)).map(Object::toString).orElse(null));
    request.setHosts((Set<String>) Optional.ofNullable(props.get(PARAM_HOSTS)).orElse(null));
    request.setExcludeHosts((Set<String>) Optional.ofNullable(props.get(PARAMS_EXCLUDE_HOSTS)).orElse(null));
    request.setHostGroups((Set<String>) Optional.ofNullable(props.get(PARAMS_HOST_GROUPS)).orElse(null));
    request.setLabels((List<String>) Optional.ofNullable(props.get(PARAMS_LABELS)).orElse(null));
    request.setAdditionalLogs((List<VmLog>) Optional.ofNullable(props.get(PARAMS_ADDITIONAL_LOGS)).orElse(null));
    request.setDescription(Optional.ofNullable(props.get(PARAM_DESCRIPTION)).map(Object::toString).orElse(null));
    request.setIssue(Optional.ofNullable(props.get(PARAMS_ISSUE)).map(Object::toString).orElse(null));
    request.setStartTime((Date) Optional.ofNullable(props.get(PARAMS_START_TIME)).orElse(null));
    request.setEndTime((Date) Optional.ofNullable(props.get(PARAMS_END_TIME)).orElse(null));
    request.setIncludeSaltLogs((Boolean) Optional.ofNullable(props.get(PARAMS_INCLUDE_SALT_LOGS)).orElse(false));
    request.setIncludeSarOutput((Boolean) Optional.ofNullable(props.get(PARAMS_INCLUDE_SAR_OUTPUT)).orElse(false));
    request.setIncludeNginxReport((Boolean) Optional.ofNullable(props.get(PARAMS_INCLUDE_NGINX_REPORT)).orElse(false));
    request.setUpdatePackage((Boolean) Optional.ofNullable(props.get(PARAMS_UPDATE_PACKAGE)).orElse(false));
    request.setSkipValidation((Boolean) Optional.ofNullable(props.get(PARAMS_SKIP_VALIDATION)).orElse(false));
    request.setSkipUnresponsiveHosts((Boolean) Optional.ofNullable(props.get(PARAMS_SKIP_UNRESPONSIVE_HOSTS)).orElse(false));
    request.setSkipWorkspaceCleanupOnStartup((Boolean) Optional.ofNullable(props.get(PARAMS_SKIP_WORKSPACE_CLEANUP_ON_STARTUP)).orElse(false));
    request.setUuid(Optional.ofNullable(props.get(PARAMS_UUID)).map(Object::toString).orElse(null));
    return request;
}
Also used : VmLog(com.sequenceiq.common.api.telemetry.model.VmLog) DiagnosticsCollectionRequest(com.sequenceiq.cloudbreak.api.endpoint.v4.diagnostics.model.DiagnosticsCollectionRequest) CmDiagnosticsCollectionRequest(com.sequenceiq.cloudbreak.api.endpoint.v4.diagnostics.model.CmDiagnosticsCollectionRequest)

Example 2 with DiagnosticsCollectionRequest

use of com.sequenceiq.cloudbreak.api.endpoint.v4.diagnostics.model.DiagnosticsCollectionRequest in project cloudbreak by hortonworks.

the class DiagnosticsService method collectDiagnostics.

public FlowIdentifier collectDiagnostics(DiagnosticsCollectionRequest request) {
    String userId = ThreadBasedUserCrnProvider.getUserCrn();
    SdxCluster cluster = sdxService.getByCrn(userId, request.getStackCrn());
    StackV4Response stackV4Response = sdxService.getDetail(cluster.getClusterName(), new HashSet<>(), cluster.getAccountId());
    diagnosticsCollectionValidator.validate(request, stackV4Response);
    Map<String, Object> properties = diagnosticsParamsConverter.convertFromRequest(request);
    SdxDiagnosticsCollectionEvent event = new SdxDiagnosticsCollectionEvent(cluster.getId(), userId, properties, null);
    FlowIdentifier flowIdentifier = sdxReactorFlowManager.triggerDiagnosticsCollection(event, cluster.getClusterName());
    LOGGER.debug("Start diagnostics collection with flow pollable identifier: {}", flowIdentifier.getPollableId());
    return flowIdentifier;
}
Also used : StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) SdxCluster(com.sequenceiq.datalake.entity.SdxCluster) FlowIdentifier(com.sequenceiq.flow.api.model.FlowIdentifier) SdxDiagnosticsCollectionEvent(com.sequenceiq.datalake.flow.diagnostics.event.SdxDiagnosticsCollectionEvent)

Example 3 with DiagnosticsCollectionRequest

use of com.sequenceiq.cloudbreak.api.endpoint.v4.diagnostics.model.DiagnosticsCollectionRequest in project cloudbreak by hortonworks.

the class SdxDiagnosticsFlowService method startDiagnosticsCollection.

public FlowIdentifier startDiagnosticsCollection(Map<String, Object> properties) {
    LOGGER.debug("Start diagnostic collection for SDX");
    DiagnosticsCollectionRequest request = diagnosticsParamsConverter.convertToRequest(properties);
    return diagnosticsV4Endpoint.collectDiagnostics(request);
}
Also used : DiagnosticsCollectionRequest(com.sequenceiq.cloudbreak.api.endpoint.v4.diagnostics.model.DiagnosticsCollectionRequest) CmDiagnosticsCollectionRequest(com.sequenceiq.cloudbreak.api.endpoint.v4.diagnostics.model.CmDiagnosticsCollectionRequest)

Aggregations

CmDiagnosticsCollectionRequest (com.sequenceiq.cloudbreak.api.endpoint.v4.diagnostics.model.CmDiagnosticsCollectionRequest)2 DiagnosticsCollectionRequest (com.sequenceiq.cloudbreak.api.endpoint.v4.diagnostics.model.DiagnosticsCollectionRequest)2 StackV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response)1 VmLog (com.sequenceiq.common.api.telemetry.model.VmLog)1 SdxCluster (com.sequenceiq.datalake.entity.SdxCluster)1 SdxDiagnosticsCollectionEvent (com.sequenceiq.datalake.flow.diagnostics.event.SdxDiagnosticsCollectionEvent)1 FlowIdentifier (com.sequenceiq.flow.api.model.FlowIdentifier)1