use of com.sequenceiq.flow.core.CommonContext in project cloudbreak by hortonworks.
the class UpgradeCcmActions method upgradeCcmValidationAction.
@Bean(name = "UPGRADE_CCM_VALIDATION_STATE")
public Action<?, ?> upgradeCcmValidationAction() {
return new AbstractUpgradeCcmAction<>(UpgradeCcmEvent.class) {
@Override
protected void doExecute(CommonContext context, UpgradeCcmEvent payload, Map<Object, Object> variables) {
EnvironmentDto envDto = environmentStatusUpdateService.updateEnvironmentStatusAndNotify(context, payload, EnvironmentStatus.UPGRADE_CCM_VALIDATION_IN_PROGRESS, ResourceEvent.ENVIRONMENT_UPGRADE_CCM_VALIDATION_STARTED, UpgradeCcmState.UPGRADE_CCM_VALIDATION_STATE);
sendEvent(context, UPGRADE_CCM_VALIDATION_HANDLER.selector(), envDto);
}
};
}
use of com.sequenceiq.flow.core.CommonContext in project cloudbreak by hortonworks.
the class UpgradeCcmActions method upgradeCcmInDataHubAction.
@Bean(name = "UPGRADE_CCM_DATAHUB_STATE")
public Action<?, ?> upgradeCcmInDataHubAction() {
return new AbstractUpgradeCcmAction<>(UpgradeCcmEvent.class) {
@Override
protected void doExecute(CommonContext context, UpgradeCcmEvent payload, Map<Object, Object> variables) {
EnvironmentDto envDto = environmentStatusUpdateService.updateEnvironmentStatusAndNotify(context, payload, EnvironmentStatus.UPGRADE_CCM_ON_DATAHUB_IN_PROGRESS, ResourceEvent.ENVIRONMENT_UPGRADE_CCM_ON_DATAHUB_STARTED, UpgradeCcmState.UPGRADE_CCM_DATAHUB_STATE);
sendEvent(context, UPGRADE_CCM_DATAHUB_HANDLER.selector(), envDto);
}
};
}
use of com.sequenceiq.flow.core.CommonContext in project cloudbreak by hortonworks.
the class EnvClustersDeleteActions method experienceDeleteAction.
@Bean(name = "EXPERIENCE_DELETE_STARTED_STATE")
public Action<?, ?> experienceDeleteAction() {
return new AbstractEnvClustersDeleteAction<>(EnvDeleteEvent.class) {
@Override
protected void doExecute(CommonContext context, EnvDeleteEvent payload, Map<Object, Object> variables) {
EnvironmentDto envDto = environmentStatusUpdateService.updateEnvironmentStatusAndNotify(context, payload, EnvironmentStatus.EXPERIENCE_DELETE_IN_PROGRESS, ResourceEvent.ENVIRONMENT_EXPERIENCE_DELETION_STARTED, EnvClustersDeleteState.EXPERIENCE_DELETE_STARTED_STATE);
EnvironmentDeletionDto environmentDeletionDto = EnvironmentDeletionDto.builder().withEnvironmentDto(envDto).withForceDelete(payload.isForceDelete()).withId(payload.getResourceId()).build();
sendEvent(context, DELETE_EXPERIENCE_EVENT.selector(), environmentDeletionDto);
}
};
}
use of com.sequenceiq.flow.core.CommonContext in project cloudbreak by hortonworks.
the class EnvClustersDeleteActions method datahubClustersDeleteAction.
@Bean(name = "DATAHUB_CLUSTERS_DELETE_STARTED_STATE")
public Action<?, ?> datahubClustersDeleteAction() {
return new AbstractEnvClustersDeleteAction<>(EnvDeleteEvent.class) {
@Override
protected void doExecute(CommonContext context, EnvDeleteEvent payload, Map<Object, Object> variables) {
EnvironmentStatus environmentStatus = EnvironmentStatus.DATAHUB_CLUSTERS_DELETE_IN_PROGRESS;
ResourceEvent resourceEvent = ResourceEvent.ENVIRONMENT_DATAHUB_CLUSTERS_DELETION_STARTED;
EnvClustersDeleteState envClustersDeleteState = EnvClustersDeleteState.DATAHUB_CLUSTERS_DELETE_STARTED_STATE;
String logDeleteState = "Data Hub clusters";
EnvironmentDeletionDto envDto = commonUpdateEnvironmentAndNotify(context, payload, environmentStatus, resourceEvent, envClustersDeleteState, logDeleteState);
sendEvent(context, DELETE_DATAHUB_CLUSTERS_EVENT.selector(), envDto);
}
};
}
use of com.sequenceiq.flow.core.CommonContext in project cloudbreak by hortonworks.
the class EnvStackConfigUpdatesActions method failedAction.
@Bean(name = "STACK_CONFIG_UPDATES_FAILED_STATE")
public Action<?, ?> failedAction() {
return new AbstractEnvStackConfigUpdatesAction<>(EnvStackConfigUpdatesFailedEvent.class) {
@Override
protected void doExecute(CommonContext context, EnvStackConfigUpdatesFailedEvent payload, Map<Object, Object> variables) {
LOGGER.warn(String.format("Failed to update environments stack configs '%s'. Status: '%s'.", payload.getEnvironmentDto(), payload.getEnvironmentStatus()), payload.getException());
EnvironmentDto environmentDto = environmentStatusUpdateService.updateFailedEnvironmentStatusAndNotify(context, payload, getCurrentStatus(payload.getResourceId()), ResourceEvent.ENVIRONMENT_STACK_CONFIGS_UPDATE_FAILED, EnvStackConfigUpdatesState.STACK_CONFIG_UPDATES_FAILED_STATE);
metricService.incrementMetricCounter(MetricType.ENV_STACK_CONFIG_UPDATE_FAILED, environmentDto, payload.getException());
sendEvent(context, HANDLE_FAILED_ENV_STACK_CONIFG_UPDATES_EVENT.event(), payload);
}
};
}
Aggregations