use of com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent in project cloudbreak by hortonworks.
the class DiagnosticsCollectionActions method diagnosticsUploadAction.
@Bean(name = "DIAGNOSTICS_UPLOAD_STATE")
public Action<?, ?> diagnosticsUploadAction() {
return new AbstractDiagnosticsCollectionActions<>(DiagnosticsCollectionEvent.class) {
@Override
protected void doExecute(CommonContext context, DiagnosticsCollectionEvent payload, Map<Object, Object> variables) {
String resourceCrn = payload.getResourceCrn();
LOGGER.debug("Flow entered into DIAGNOSTICS_UPLOAD_STATE. resourceCrn: '{}'", resourceCrn);
DiagnosticsCollectionEvent event = DiagnosticsCollectionEvent.builder().withResourceId(payload.getResourceId()).withResourceCrn(payload.getResourceCrn()).withSelector(DiagnosticsCollectionHandlerSelectors.UPLOAD_DIAGNOSTICS_EVENT.selector()).withParameters(payload.getParameters()).build();
sendEvent(context, event);
}
};
}
use of com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent in project cloudbreak by hortonworks.
the class DiagnosticsCollectionActions method diagnosticsCreateMachineUserAction.
@Bean(name = "DIAGNOSTICS_ENSURE_MACHINE_USER_STATE")
public Action<?, ?> diagnosticsCreateMachineUserAction() {
return new AbstractDiagnosticsCollectionActions<>(DiagnosticsCollectionEvent.class) {
@Override
protected void doExecute(CommonContext context, DiagnosticsCollectionEvent payload, Map<Object, Object> variables) {
String resourceCrn = payload.getResourceCrn();
LOGGER.debug("Flow entered into ENSURE_MACHINE_USER_EVENT. resourceCrn: '{}'", resourceCrn);
DiagnosticsCollectionEvent event = DiagnosticsCollectionEvent.builder().withResourceId(payload.getResourceId()).withResourceCrn(payload.getResourceCrn()).withSelector(DiagnosticsCollectionHandlerSelectors.ENSURE_MACHINE_USER_EVENT.selector()).withParameters(payload.getParameters()).build();
sendEvent(context, event);
}
};
}
use of com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent in project cloudbreak by hortonworks.
the class DiagnosticsCollectionActions method diagnosticsCleanupAction.
@Bean(name = "DIAGNOSTICS_CLEANUP_STATE")
public Action<?, ?> diagnosticsCleanupAction() {
return new AbstractDiagnosticsCollectionActions<>(DiagnosticsCollectionEvent.class) {
@Override
protected void doExecute(CommonContext context, DiagnosticsCollectionEvent payload, Map<Object, Object> variables) {
String resourceCrn = payload.getResourceCrn();
LOGGER.debug("Flow entered into DIAGNOSTICS_CLEANUP_STATE. resourceCrn: '{}'", resourceCrn);
DiagnosticsCollectionEvent event = DiagnosticsCollectionEvent.builder().withResourceId(payload.getResourceId()).withResourceCrn(payload.getResourceCrn()).withSelector(DiagnosticsCollectionHandlerSelectors.CLEANUP_DIAGNOSTICS_EVENT.selector()).withParameters(payload.getParameters()).build();
sendEvent(context, event);
}
};
}
use of com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent in project cloudbreak by hortonworks.
the class DiagnosticsService method startDiagnosticsCollection.
public FlowIdentifier startDiagnosticsCollection(DiagnosticsCollectionRequest request, String accountId, String userCrn) {
Stack stack = stackService.getByEnvironmentCrnAndAccountIdWithListsAndMdcContext(request.getEnvironmentCrn(), accountId);
diagnosticsCollectionValidator.validate(request, stack);
LOGGER.debug("Starting diagnostics collection for FreeIpa. Crn: '{}'", stack.getResourceCrn());
boolean useDbusCnameEndpoint = entitlementService.useDataBusCNameEndpointEnabled(stack.getAccountId());
String databusEndpoint = dataBusEndpointProvider.getDataBusEndpoint(stack.getTelemetry().getDatabusEndpoint(), useDbusCnameEndpoint);
DiagnosticParameters parameters = diagnosticsDataToParameterConverter.convert(request, stack.getTelemetry(), FREEIPA_CLUSTER_TYPE, stack.getAppVersion(), stack.getAccountId(), stack.getRegion(), databusEndpoint);
DiagnosticsCollectionEvent diagnosticsCollectionEvent = DiagnosticsCollectionEvent.builder().withAccepted(new Promise<>()).withResourceId(stack.getId()).withResourceCrn(stack.getResourceCrn()).withSelector(DiagnosticsCollectionStateSelectors.START_DIAGNOSTICS_SALT_VALIDATION_EVENT.selector()).withParameters(parameters).build();
return flowManager.notify(diagnosticsCollectionEvent, getFlowHeaders(userCrn));
}
use of com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent in project cloudbreak by hortonworks.
the class DiagnosticsUpgradeTelemetryHandlerTest method testDoAccept.
@Test
public void testDoAccept() throws CloudbreakOrchestratorFailedException {
// GIVEN
doNothing().when(telemetryUpgradeService).upgradeTelemetryComponent(anyLong(), any(), any());
// WHEN
DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(UPGRADE_DIAGNOSTICS_EVENT.selector(), STACK_ID, "crn", new DiagnosticParameters());
underTest.doAccept(new HandlerEvent<>(new Event<>(event)));
// THEN
verify(telemetryUpgradeService, times(1)).upgradeTelemetryComponent(anyLong(), any(), any());
}
Aggregations