Search in sources :

Example 1 with ClusterCredentialChangeTriggerEvent

use of com.sequenceiq.cloudbreak.core.flow2.event.ClusterCredentialChangeTriggerEvent in project cloudbreak by hortonworks.

the class ReactorFlowManager method triggerClusterCredentialReplace.

public void triggerClusterCredentialReplace(Long stackId, String userName, String password) {
    String selector = CLUSTER_CREDENTIALCHANGE_EVENT.event();
    ClusterCredentialChangeTriggerEvent event = ClusterCredentialChangeTriggerEvent.replaceUserEvent(selector, stackId, userName, password);
    notify(selector, event);
}
Also used : ClusterCredentialChangeTriggerEvent(com.sequenceiq.cloudbreak.core.flow2.event.ClusterCredentialChangeTriggerEvent)

Example 2 with ClusterCredentialChangeTriggerEvent

use of com.sequenceiq.cloudbreak.core.flow2.event.ClusterCredentialChangeTriggerEvent 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);
        }
    };
}
Also used : ClusterCredentialChangeTriggerEvent(com.sequenceiq.cloudbreak.core.flow2.event.ClusterCredentialChangeTriggerEvent) ClusterCredentialChangeRequest(com.sequenceiq.cloudbreak.reactor.api.event.resource.ClusterCredentialChangeRequest) 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 3 with ClusterCredentialChangeTriggerEvent

use of com.sequenceiq.cloudbreak.core.flow2.event.ClusterCredentialChangeTriggerEvent in project cloudbreak by hortonworks.

the class ReactorFlowManager method triggerClusterCredentialUpdate.

public void triggerClusterCredentialUpdate(Long stackId, String password) {
    String selector = CLUSTER_CREDENTIALCHANGE_EVENT.event();
    ClusterCredentialChangeTriggerEvent event = ClusterCredentialChangeTriggerEvent.changePasswordEvent(selector, stackId, password);
    notify(selector, event);
}
Also used : ClusterCredentialChangeTriggerEvent(com.sequenceiq.cloudbreak.core.flow2.event.ClusterCredentialChangeTriggerEvent)

Aggregations

ClusterCredentialChangeTriggerEvent (com.sequenceiq.cloudbreak.core.flow2.event.ClusterCredentialChangeTriggerEvent)3 AbstractClusterAction (com.sequenceiq.cloudbreak.core.flow2.cluster.AbstractClusterAction)1 ClusterViewContext (com.sequenceiq.cloudbreak.core.flow2.cluster.ClusterViewContext)1 ClusterCredentialChangeRequest (com.sequenceiq.cloudbreak.reactor.api.event.resource.ClusterCredentialChangeRequest)1 Map (java.util.Map)1 Bean (org.springframework.context.annotation.Bean)1