use of com.sequenceiq.cloudbreak.core.flow2.cluster.ClusterViewContext in project cloudbreak by hortonworks.
the class ChangePrimaryGatewayActions method repairGatewayAction.
@Bean(name = "CHANGE_PRIMARY_GATEWAY_STATE")
public Action<?, ?> repairGatewayAction() {
return new AbstractClusterAction<ChangePrimaryGatewayTriggerEvent>(ChangePrimaryGatewayTriggerEvent.class) {
@Override
protected void doExecute(ClusterViewContext context, ChangePrimaryGatewayTriggerEvent payload, Map<Object, Object> variables) {
changePrimaryGatewayService.changePrimaryGatewayStarted(context.getStackId());
Selectable request = new ChangePrimaryGatewayRequest(context.getStackId());
sendEvent(context.getFlowId(), request.selector(), request);
}
};
}
use of com.sequenceiq.cloudbreak.core.flow2.cluster.ClusterViewContext in project cloudbreak by hortonworks.
the class AbstractClusterResetAction method createFlowContext.
@Override
protected ClusterViewContext createFlowContext(String flowId, StateContext<ClusterResetState, ClusterResetEvent> stateContext, P payload) {
StackView stack = stackService.getByIdView(payload.getStackId());
MDCBuilder.buildMdcContext(stack.getId().toString(), stack.getName(), stack.getOwner(), "CLUSTER");
return new ClusterViewContext(flowId, stack);
}
use of com.sequenceiq.cloudbreak.core.flow2.cluster.ClusterViewContext in project cloudbreak by hortonworks.
the class ClusterDownscaleActions method collectCandidatesAction.
@Bean(name = "COLLECT_CANDIDATES_STATE")
public Action<?, ?> collectCandidatesAction() {
return new AbstractClusterAction<ClusterDownscaleTriggerEvent>(ClusterDownscaleTriggerEvent.class) {
@Override
protected void doExecute(ClusterViewContext context, ClusterDownscaleTriggerEvent payload, Map<Object, Object> variables) {
clusterDownscaleService.clusterDownscaleStarted(context.getStackId(), payload.getHostGroupName(), payload.getAdjustment(), payload.getHostNames());
Selectable request = new CollectDownscaleCandidatesRequest(context.getStackId(), payload.getHostGroupName(), payload.getAdjustment(), payload.getHostNames());
sendEvent(context.getFlowId(), request.selector(), request);
}
};
}
use of com.sequenceiq.cloudbreak.core.flow2.cluster.ClusterViewContext in project cloudbreak by hortonworks.
the class ClusterCredentialChangeActions method changingClusterCredential.
@Bean(name = "CLUSTER_CREDENTIALCHANGE_STATE")
public Action<?, ?> changingClusterCredential() {
return new AbstractClusterAction<ClusterCredentialChangeTriggerEvent>(ClusterCredentialChangeTriggerEvent.class) {
@Override
protected void doExecute(ClusterViewContext ctx, ClusterCredentialChangeTriggerEvent payload, Map<Object, Object> variables) {
clusterCredentialChangeService.credentialChange(ctx.getStackId());
ClusterCredentialChangeRequest request;
switch(payload.getType()) {
case REPLACE:
request = ClusterCredentialChangeRequest.replaceUserRequest(ctx.getStackId(), payload.getUser(), payload.getPassword());
break;
case UPDATE:
request = ClusterCredentialChangeRequest.changePasswordRequest(ctx.getStackId(), payload.getPassword());
break;
default:
throw new UnsupportedOperationException("Ambari credential update request not supported: " + payload.getType());
}
sendEvent(ctx.getFlowId(), request);
}
};
}
use of com.sequenceiq.cloudbreak.core.flow2.cluster.ClusterViewContext in project cloudbreak by hortonworks.
the class AbstractClusterUpgradeAction method createFlowContext.
@Override
protected ClusterViewContext createFlowContext(String flowId, StateContext<ClusterUpgradeState, ClusterUpgradeEvent> stateContext, P payload) {
StackView stack = stackService.getByIdView(payload.getStackId());
MDCBuilder.buildMdcContext(stack.getId().toString(), stack.getName(), stack.getOwner(), "CLUSTER");
return new ClusterViewContext(flowId, stack);
}
Aggregations