use of com.sequenceiq.flow.core.CommonContext in project cloudbreak by hortonworks.
the class DiagnosticsCollectionActions method diagnosticsVmPreFlightCheckAction.
@Bean(name = "DIAGNOSTICS_VM_PREFLIGHT_CHECK_STATE")
public Action<?, ?> diagnosticsVmPreFlightCheckAction() {
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_VM_PREFLIGHT_CHECK_STATE. resourceCrn: '{}'", resourceCrn);
DiagnosticsCollectionEvent event = DiagnosticsCollectionEvent.builder().withResourceId(payload.getResourceId()).withResourceCrn(resourceCrn).withSelector(DiagnosticsCollectionHandlerSelectors.VM_PREFLIGHT_CHECK_DIAGNOSTICS_EVENT.selector()).withParameters(payload.getParameters()).build();
sendEvent(context, event);
}
};
}
use of com.sequenceiq.flow.core.CommonContext in project cloudbreak by hortonworks.
the class DiagnosticsCollectionActions method diagnosticsSaltValidateAction.
@Bean(name = "DIAGNOSTICS_SALT_VALIDATION_STATE")
public Action<?, ?> diagnosticsSaltValidateAction() {
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_SALT_VALIDATION_STATE. resourceCrn: '{}'", resourceCrn);
InMemoryStateStore.putStack(payload.getResourceId(), PollGroup.POLLABLE);
DiagnosticsCollectionEvent event = DiagnosticsCollectionEvent.builder().withResourceId(payload.getResourceId()).withResourceCrn(resourceCrn).withSelector(DiagnosticsCollectionHandlerSelectors.SALT_VALIDATION_DIAGNOSTICS_EVENT.selector()).withParameters(payload.getParameters()).build();
sendEvent(context, event);
}
};
}
use of com.sequenceiq.flow.core.CommonContext in project cloudbreak by hortonworks.
the class DiagnosticsCollectionActions method diagnosticsSaltStateUpdateAction.
@Bean(name = "DIAGNOSTICS_SALT_STATE_UPDATE_STATE")
public Action<?, ?> diagnosticsSaltStateUpdateAction() {
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_SALT_STATE_UPDATE_STATE. resourceCrn: '{}'", resourceCrn);
DiagnosticsCollectionEvent event = DiagnosticsCollectionEvent.builder().withResourceId(payload.getResourceId()).withResourceCrn(resourceCrn).withSelector(DiagnosticsCollectionHandlerSelectors.SALT_STATE_UPDATE_DIAGNOSTICS_EVENT.selector()).withParameters(payload.getParameters()).build();
sendEvent(context, event);
}
};
}
use of com.sequenceiq.flow.core.CommonContext in project cloudbreak by hortonworks.
the class DiagnosticsCollectionActions method diagnosticsCollectionFinishedAction.
@Bean(name = "DIAGNOSTICS_COLLECTION_FINISHED_STATE")
public Action<?, ?> diagnosticsCollectionFinishedAction() {
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_COLLECTION_FINISHED_STATE. resourceCrn: '{}'", resourceCrn);
InMemoryStateStore.deleteStack(payload.getResourceId());
DiagnosticsCollectionEvent event = DiagnosticsCollectionEvent.builder().withResourceId(payload.getResourceId()).withResourceCrn(payload.getResourceCrn()).withSelector(DiagnosticsCollectionStateSelectors.FINALIZE_DIAGNOSTICS_COLLECTION_EVENT.selector()).withParameters(payload.getParameters()).build();
diagnosticsOperationsService.vmDiagnosticsReport(resourceCrn, payload.getParameters());
sendEvent(context, event);
}
};
}
Aggregations