use of com.sequenceiq.flow.core.CommonContext in project cloudbreak by hortonworks.
the class LoadBalancerUpdateActions method stackLoadBalancerUpdate.
@Bean(name = "STACK_UPDATE_STATE")
public Action<?, ?> stackLoadBalancerUpdate() {
return new AbstractLoadBalancerUpdateAction<>(LoadBalancerUpdateEvent.class) {
@Override
protected void doExecute(CommonContext context, LoadBalancerUpdateEvent payload, Map<Object, Object> variables) {
EnvironmentStatus environmentStatus = EnvironmentStatus.LOAD_BALANCER_STACK_UPDATE_STARTED;
ResourceEvent resourceEvent = ResourceEvent.ENVIRONMENT_LOAD_BALANCER_STACK_UPDATE_STARTED;
LoadBalancerUpdateState loadBalancerUpdateState = LoadBalancerUpdateState.STACK_UPDATE_STATE;
EnvironmentDto envDto = environmentStatusUpdateService.updateEnvironmentStatusAndNotify(context, payload, environmentStatus, resourceEvent, loadBalancerUpdateState);
EnvironmentLoadBalancerDto environmentLoadBalancerDto = EnvironmentLoadBalancerDto.builder().withId(envDto.getId()).withEnvironmentDto(payload.getEnvironmentDto()).withEndpointAccessGateway(payload.getEndpointAccessGateway()).withEndpointGatewaySubnetIds(payload.getSubnetIds()).build();
sendEvent(context, LoadBalancerUpdateHandlerSelectors.STACK_UPDATE_HANDLER_EVENT.selector(), environmentLoadBalancerDto);
}
};
}
use of com.sequenceiq.flow.core.CommonContext in project cloudbreak by hortonworks.
the class LoadBalancerUpdateActions method environmentLoadBalancerUpdate.
@Bean(name = "ENVIRONMENT_UPDATE_STATE")
public Action<?, ?> environmentLoadBalancerUpdate() {
return new AbstractLoadBalancerUpdateAction<>(LoadBalancerUpdateEvent.class) {
@Override
protected void doExecute(CommonContext context, LoadBalancerUpdateEvent payload, Map<Object, Object> variables) {
EnvironmentStatus environmentStatus = EnvironmentStatus.LOAD_BALANCER_ENV_UPDATE_STARTED;
ResourceEvent resourceEvent = ResourceEvent.ENVIRONMENT_LOAD_BALANCER_ENV_UPDATE_STARTED;
LoadBalancerUpdateState loadBalancerUpdateState = LoadBalancerUpdateState.ENVIRONMENT_UPDATE_STATE;
EnvironmentDto envDto = environmentStatusUpdateService.updateEnvironmentStatusAndNotify(context, payload, environmentStatus, resourceEvent, loadBalancerUpdateState);
EnvironmentLoadBalancerDto environmentLoadBalancerDto = EnvironmentLoadBalancerDto.builder().withId(envDto.getId()).withEnvironmentDto(payload.getEnvironmentDto()).withEndpointAccessGateway(payload.getEndpointAccessGateway()).withEndpointGatewaySubnetIds(payload.getSubnetIds()).build();
sendEvent(context, LoadBalancerUpdateHandlerSelectors.ENVIRONMENT_UPDATE_HANDLER_EVENT.selector(), environmentLoadBalancerDto);
}
};
}
use of com.sequenceiq.flow.core.CommonContext in project cloudbreak by hortonworks.
the class LoadBalancerUpdateActions method failedAction.
@Bean(name = "LOAD_BALANCER_UPDATE_FAILED_STATE")
public Action<?, ?> failedAction() {
return new AbstractLoadBalancerUpdateAction<>(LoadBalancerUpdateFailedEvent.class) {
@Override
protected void doExecute(CommonContext context, LoadBalancerUpdateFailedEvent payload, Map<Object, Object> variables) {
LOGGER.warn(String.format("Failed to update load balancer on environment '%s'. Status: '%s'.", payload.getEnvironmentDto(), payload.getEnvironmentStatus()), payload.getException());
EnvironmentDto environmentDto = environmentStatusUpdateService.updateFailedEnvironmentStatusAndNotify(context, payload, payload.getEnvironmentStatus(), convertStatus(payload.getEnvironmentStatus()), LoadBalancerUpdateState.LOAD_BALANCER_UPDATE_FAILED_STATE);
metricService.incrementMetricCounter(MetricType.ENV_LOAD_BALANCER_UPDATE_FAILED, environmentDto, payload.getException());
sendEvent(context, HANDLED_FAILED_LOAD_BALANCER_UPDATE_EVENT.event(), payload);
}
};
}
use of com.sequenceiq.flow.core.CommonContext in project cloudbreak by hortonworks.
the class UpgradeCcmActions method upgradeCcmUpdateTunnelAction.
@Bean(name = "UPGRADE_CCM_TUNNEL_UPDATE_STATE")
public Action<?, ?> upgradeCcmUpdateTunnelAction() {
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_TUNNEL_UPDATE_IN_PROGRESS, ResourceEvent.ENVIRONMENT_UPGRADE_CCM_TUNNEL_UPDATE_STARTED, UpgradeCcmState.UPGRADE_CCM_TUNNEL_UPDATE_STATE);
sendEvent(context, UPGRADE_CCM_TUNNEL_UPDATE_HANDLER.selector(), envDto);
}
};
}
use of com.sequenceiq.flow.core.CommonContext in project cloudbreak by hortonworks.
the class UpgradeCcmActions method upgradeCcmInDataLakeAction.
@Bean(name = "UPGRADE_CCM_DATALAKE_STATE")
public Action<?, ?> upgradeCcmInDataLakeAction() {
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_DATALAKE_IN_PROGRESS, ResourceEvent.ENVIRONMENT_UPGRADE_CCM_ON_DATALAKE_STARTED, UpgradeCcmState.UPGRADE_CCM_DATALAKE_STATE);
sendEvent(context, UPGRADE_CCM_DATALAKE_HANDLER.selector(), envDto);
}
};
}
Aggregations