use of com.sequenceiq.cloudbreak.core.flow2.diagnostics.DiagnosticsCollectionsState.DIAGNOSTICS_COLLECTION_FINISHED_STATE 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) {
Long resourceId = payload.getResourceId();
String resourceCrn = payload.getResourceCrn();
LOGGER.debug("Flow entered into DIAGNOSTICS_COLLECTION_FINISHED_STATE. resourceCrn: '{}'", resourceCrn);
cloudbreakEventService.fireCloudbreakEvent(resourceId, AVAILABLE.name(), ResourceEvent.STACK_DIAGNOSTICS_COLLECTION_FINISHED);
InMemoryStateStore.deleteStack(resourceId);
DiagnosticsCollectionEvent event = DiagnosticsCollectionEvent.builder().withResourceId(resourceId).withResourceCrn(payload.getResourceCrn()).withSelector(DiagnosticsCollectionStateSelectors.FINALIZE_DIAGNOSTICS_COLLECTION_EVENT.selector()).withParameters(payload.getParameters()).withHosts(payload.getHosts()).withHostGroups(payload.getHostGroups()).withExcludeHosts(payload.getExcludeHosts()).build();
diagnosticsOperationsService.vmDiagnosticsReport(resourceCrn, payload.getParameters());
sendEvent(context, event);
}
};
}
Aggregations