use of com.sequenceiq.cloudbreak.api.endpoint.v4.diagnostics.model.CmDiagnosticsCollectionRequest in project cloudbreak by hortonworks.
the class SdxDiagnosticsFlowService method startCmDiagnosticsCollection.
public FlowIdentifier startCmDiagnosticsCollection(Map<String, Object> properties) {
LOGGER.debug("Start CM based diagnostic collection for SDX");
CmDiagnosticsCollectionRequest request = diagnosticsParamsConverter.convertToCmRequest(properties);
return diagnosticsV4Endpoint.collectCmDiagnostics(request);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.diagnostics.model.CmDiagnosticsCollectionRequest in project cloudbreak by hortonworks.
the class DiagnosticsParamsConverter method convertToCmRequest.
public CmDiagnosticsCollectionRequest convertToCmRequest(Map<String, Object> props) {
CmDiagnosticsCollectionRequest request = new CmDiagnosticsCollectionRequest();
request.setStackCrn(Optional.ofNullable(props.get(PARAMS_STACK_CRN)).map(Object::toString).orElse(null));
request.setTicket(Optional.ofNullable(props.get(PARAMS_TICKET)).map(Object::toString).orElse(null));
request.setComments(Optional.ofNullable(props.get(PARAMS_COMMENTS)).map(Object::toString).orElse(null));
request.setBundleSizeBytes(Optional.ofNullable(props.get(PARAMS_BUNDLE_SIZE_BYTES)).map(n -> BigDecimal.valueOf(Long.parseLong(n.toString()))).orElse(null));
request.setDestination(Optional.ofNullable(props.get(PARAM_DESTINATION)).map(v -> DiagnosticsDestination.valueOf(v.toString())).orElse(null));
request.setRoles((List<String>) Optional.ofNullable(props.get(PARAMS_ROLES)).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.setEnableMonitorMetricsCollection((Boolean) Optional.ofNullable(props.get(PARAMS_ENABLE_MONITOR_METRICS_COLLECTION)).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));
return request;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.diagnostics.model.CmDiagnosticsCollectionRequest in project cloudbreak by hortonworks.
the class DiagnosticsService method collectCmDiagnostics.
public FlowIdentifier collectCmDiagnostics(CmDiagnosticsCollectionRequest 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.convertFromCmRequest(request);
SdxCmDiagnosticsCollectionEvent event = new SdxCmDiagnosticsCollectionEvent(cluster.getId(), userId, properties, null);
FlowIdentifier flowIdentifier = sdxReactorFlowManager.triggerCmDiagnosticsCollection(event, cluster.getClusterName());
LOGGER.debug("Start CM based diagnostics collection with flow pollable identifier: {}", flowIdentifier.getPollableId());
return flowIdentifier;
}
Aggregations