class ClouderaManagerSecurityService implements ClusterSecurityService {

    @Override
    public void changeOriginalCredentialsAndCreateCloudbreakUser(boolean ldapConfigured) throws CloudbreakException {
        LOGGER.debug("change original admin user and create cloudbreak user");
        try {
            ApiClient client = createApiClient();
            UsersResourceApi usersResourceApi = clouderaManagerApiFactory.getUserResourceApi(client);
            ApiUser2List userList = usersResourceApi.readUsers2("SUMMARY");

            ApiUser2 oldAdminUser = getOldAdminUser(userList).orElseThrow(() -> new CloudbreakException("Can't find original admin user"));
            Cluster cluster = stack.getCluster();
            createNewUser(usersResourceApi, oldAdminUser.getAuthRoles(), cluster.getCloudbreakAmbariUser(), cluster.getCloudbreakAmbariPassword(), userList);
            createNewUser(usersResourceApi, oldAdminUser.getAuthRoles(), cluster.getDpAmbariUser(), cluster.getDpAmbariPassword(), userList);
            if (ADMIN_USER.equals(cluster.getUserName())) {
                ApiUser2 oldAdmin = oldAdminUser;
                oldAdmin.setPassword(cluster.getPassword());
                usersResourceApi.updateUser2(oldAdminUser.getName(), oldAdmin);
            } else if (cluster.getUserName() != null) {
                createUserSuppliedCMUser(userList, oldAdminUser, cluster);
            }
            removeDefaultAdminUser(ldapConfigured, Optional.ofNullable(cluster.getUserName()));
        } catch (ApiException | ClusterClientInitException | ClouderaManagerClientInitException e) {
            LOGGER.info("Can't replace original admin user due to: ", e);
            throw new CloudbreakException("Can't replace original admin user due to: " + e.getMessage());
        }
    }

    public  ClouderaManagerSecurityService(Stack stack, HttpClientConfig clientConfig);

}