use of com.sequenceiq.cloudbreak.reactor.api.event.resource.ClusterCredentialChangeResult in project cloudbreak by hortonworks.
the class ClusterCredentialChangeHandler method accept.
@Override
public void accept(Event<ClusterCredentialChangeRequest> event) {
ClusterCredentialChangeRequest request = event.getData();
ClusterCredentialChangeResult result;
try {
Stack stack = stackService.getByIdWithLists(request.getStackId());
switch(request.getType()) {
case REPLACE:
ambariClusterConnector.replaceUserNamePassword(stack, request.getUser(), request.getPassword());
break;
case UPDATE:
ambariClusterConnector.updateUserNamePassword(stack, request.getPassword());
break;
default:
throw new UnsupportedOperationException("Ambari credential update request not supported: " + request.getType());
}
result = new ClusterCredentialChangeResult(request);
} catch (Exception e) {
result = new ClusterCredentialChangeResult(e.getMessage(), e, request);
}
eventBus.notify(result.selector(), new Event<>(event.getHeaders(), result));
}
Aggregations