Search in sources :

Example 6 with ClusterViewContext

use of com.sequenceiq.cloudbreak.core.flow2.cluster.ClusterViewContext in project cloudbreak by hortonworks.

the class ClusterTerminationActions method terminatingCluster.

@Bean(name = "CLUSTER_TERMINATING_STATE")
public Action<?, ?> terminatingCluster() {
    return new AbstractClusterAction<StackEvent>(StackEvent.class) {

        @Override
        protected void doExecute(ClusterViewContext context, StackEvent payload, Map<Object, Object> variables) {
            clusterTerminationFlowService.terminateCluster(context);
            sendEvent(context);
        }

        @Override
        protected void initPayloadConverterMap(List<PayloadConverter<StackEvent>> payloadConverters) {
            payloadConverters.add(new DisableKerberosResultToStackEventConverter());
        }

        @Override
        protected Selectable createRequest(ClusterViewContext context) {
            return new ClusterTerminationRequest(context.getStackId(), context.getClusterView() != null ? context.getClusterView().getId() : null);
        }
    };
}
Also used : StackEvent(com.sequenceiq.cloudbreak.reactor.api.event.StackEvent) DisableKerberosResultToStackEventConverter(com.sequenceiq.cloudbreak.core.flow2.stack.provision.DisableKerberosResultToStackEventConverter) List(java.util.List) ClusterTerminationRequest(com.sequenceiq.cloudbreak.reactor.api.event.orchestration.ClusterTerminationRequest) PrepareClusterTerminationRequest(com.sequenceiq.cloudbreak.reactor.api.event.cluster.PrepareClusterTerminationRequest) AbstractClusterAction(com.sequenceiq.cloudbreak.core.flow2.cluster.AbstractClusterAction) Map(java.util.Map) ClusterViewContext(com.sequenceiq.cloudbreak.core.flow2.cluster.ClusterViewContext) Bean(org.springframework.context.annotation.Bean)

Example 7 with ClusterViewContext

use of com.sequenceiq.cloudbreak.core.flow2.cluster.ClusterViewContext in project cloudbreak by hortonworks.

the class EphemeralClusterActions method updateNameserverAction.

@Bean(name = "EPHEMERAL_CLUSTER_UPDATE_STATE")
public Action<?, ?> updateNameserverAction() {
    return new AbstractClusterAction<EphemeralClusterUpdateTriggerEvent>(EphemeralClusterUpdateTriggerEvent.class) {

        @Override
        protected void doExecute(ClusterViewContext context, EphemeralClusterUpdateTriggerEvent payload, Map<Object, Object> variables) {
            ephemeralClusterService.updateClusterStarted(context.getStackId());
            Selectable request = new EphemeralClusterUpdateRequest(context.getStackId());
            sendEvent(context.getFlowId(), request.selector(), request);
        }
    };
}
Also used : EphemeralClusterUpdateRequest(com.sequenceiq.cloudbreak.reactor.api.event.orchestration.EphemeralClusterUpdateRequest) Selectable(com.sequenceiq.cloudbreak.cloud.event.Selectable) EphemeralClusterUpdateTriggerEvent(com.sequenceiq.cloudbreak.reactor.api.event.orchestration.EphemeralClusterUpdateTriggerEvent) AbstractClusterAction(com.sequenceiq.cloudbreak.core.flow2.cluster.AbstractClusterAction) Map(java.util.Map) ClusterViewContext(com.sequenceiq.cloudbreak.core.flow2.cluster.ClusterViewContext) Bean(org.springframework.context.annotation.Bean)

Example 8 with ClusterViewContext

use of com.sequenceiq.cloudbreak.core.flow2.cluster.ClusterViewContext in project cloudbreak by hortonworks.

the class ClusterDownscaleActions method decommissionAction.

@Bean(name = "DECOMMISSION_STATE")
public Action<?, ?> decommissionAction() {
    return new AbstractClusterAction<CollectDownscaleCandidatesResult>(CollectDownscaleCandidatesResult.class) {

        @Override
        protected void doExecute(ClusterViewContext context, CollectDownscaleCandidatesResult payload, Map<Object, Object> variables) {
            Selectable request = new DecommissionRequest(context.getStackId(), payload.getHostGroupName(), payload.getHostNames());
            sendEvent(context.getFlowId(), request.selector(), request);
        }
    };
}
Also used : Selectable(com.sequenceiq.cloudbreak.cloud.event.Selectable) DecommissionRequest(com.sequenceiq.cloudbreak.reactor.api.event.resource.DecommissionRequest) CollectDownscaleCandidatesResult(com.sequenceiq.cloudbreak.reactor.api.event.resource.CollectDownscaleCandidatesResult) AbstractClusterAction(com.sequenceiq.cloudbreak.core.flow2.cluster.AbstractClusterAction) Map(java.util.Map) ClusterViewContext(com.sequenceiq.cloudbreak.core.flow2.cluster.ClusterViewContext) Bean(org.springframework.context.annotation.Bean)

Aggregations

ClusterViewContext (com.sequenceiq.cloudbreak.core.flow2.cluster.ClusterViewContext)8 AbstractClusterAction (com.sequenceiq.cloudbreak.core.flow2.cluster.AbstractClusterAction)6 Map (java.util.Map)6 Bean (org.springframework.context.annotation.Bean)6 Selectable (com.sequenceiq.cloudbreak.cloud.event.Selectable)4 StackView (com.sequenceiq.cloudbreak.domain.view.StackView)2 ClusterCredentialChangeTriggerEvent (com.sequenceiq.cloudbreak.core.flow2.event.ClusterCredentialChangeTriggerEvent)1 ClusterDownscaleTriggerEvent (com.sequenceiq.cloudbreak.core.flow2.event.ClusterDownscaleTriggerEvent)1 DisableKerberosResultToStackEventConverter (com.sequenceiq.cloudbreak.core.flow2.stack.provision.DisableKerberosResultToStackEventConverter)1 StackEvent (com.sequenceiq.cloudbreak.reactor.api.event.StackEvent)1 PrepareClusterTerminationRequest (com.sequenceiq.cloudbreak.reactor.api.event.cluster.PrepareClusterTerminationRequest)1 ChangePrimaryGatewayRequest (com.sequenceiq.cloudbreak.reactor.api.event.orchestration.ChangePrimaryGatewayRequest)1 ChangePrimaryGatewayTriggerEvent (com.sequenceiq.cloudbreak.reactor.api.event.orchestration.ChangePrimaryGatewayTriggerEvent)1 ClusterTerminationRequest (com.sequenceiq.cloudbreak.reactor.api.event.orchestration.ClusterTerminationRequest)1 EphemeralClusterUpdateRequest (com.sequenceiq.cloudbreak.reactor.api.event.orchestration.EphemeralClusterUpdateRequest)1 EphemeralClusterUpdateTriggerEvent (com.sequenceiq.cloudbreak.reactor.api.event.orchestration.EphemeralClusterUpdateTriggerEvent)1 ClusterCredentialChangeRequest (com.sequenceiq.cloudbreak.reactor.api.event.resource.ClusterCredentialChangeRequest)1 CollectDownscaleCandidatesRequest (com.sequenceiq.cloudbreak.reactor.api.event.resource.CollectDownscaleCandidatesRequest)1 CollectDownscaleCandidatesResult (com.sequenceiq.cloudbreak.reactor.api.event.resource.CollectDownscaleCandidatesResult)1 DecommissionRequest (com.sequenceiq.cloudbreak.reactor.api.event.resource.DecommissionRequest)1