Search in sources :

Example 1 with RETRIEVE_FULL_UMS_STATE

use of com.sequenceiq.freeipa.service.freeipa.user.UserSyncLogEvent.RETRIEVE_FULL_UMS_STATE in project cloudbreak by hortonworks.

the class UserSyncForEnvService method startAsyncSyncsForStacks.

private Map<String, Future<SyncStatusDetail>> startAsyncSyncsForStacks(String operationId, String accountId, List<Stack> stacks, UserSyncRequestFilter userSyncFilter, UserSyncOptions options, Set<String> environmentCrns) {
    if (userSyncFilter.getDeletedWorkloadUser().isEmpty()) {
        UserSyncLogEvent logRetrieveUmsEvent = options.isFullSync() ? RETRIEVE_FULL_UMS_STATE : RETRIEVE_PARTIAL_UMS_STATE;
        LOGGER.debug("Starting {} for environments {} ...", logRetrieveUmsEvent, environmentCrns);
        Map<String, UmsUsersState> envToUmsStateMap = umsUsersStateProviderDispatcher.getEnvToUmsUsersStateMap(accountId, environmentCrns, userSyncFilter.getUserCrnFilter(), userSyncFilter.getMachineUserCrnFilter(), MDCUtils.getRequestId());
        LOGGER.debug("Finished {}.", logRetrieveUmsEvent);
        UmsEventGenerationIds umsEventGenerationIds = options.isFullSync() ? umsEventGenerationIdsProvider.getEventGenerationIds(accountId, MDCUtils.getRequestId()) : null;
        return stacks.stream().collect(Collectors.toMap(Stack::getEnvironmentCrn, stack -> asyncSynchronizeStack(stack, envToUmsStateMap.get(stack.getEnvironmentCrn()), umsEventGenerationIds, options, operationId, accountId)));
    } else {
        String deletedWorkloadUser = userSyncFilter.getDeletedWorkloadUser().get();
        return stacks.stream().collect(Collectors.toMap(Stack::getEnvironmentCrn, stack -> asyncSynchronizeStackForDeleteUser(stack, deletedWorkloadUser)));
    }
}
Also used : EntitlementService(com.sequenceiq.cloudbreak.auth.altus.EntitlementService) PARTIAL_USER_SYNC(com.sequenceiq.freeipa.service.freeipa.user.UserSyncLogEvent.PARTIAL_USER_SYNC) LoggerFactory(org.slf4j.LoggerFactory) TimeoutException(java.util.concurrent.TimeoutException) Multimap(com.google.common.collect.Multimap) UmsUsersStateProviderDispatcher(com.sequenceiq.freeipa.service.freeipa.user.ums.UmsUsersStateProviderDispatcher) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) Value(org.springframework.beans.factory.annotation.Value) Future(java.util.concurrent.Future) Service(org.springframework.stereotype.Service) Map(java.util.Map) Qualifier(org.springframework.beans.factory.annotation.Qualifier) UsersyncConfig(com.sequenceiq.freeipa.configuration.UsersyncConfig) RETRIEVE_FULL_UMS_STATE(com.sequenceiq.freeipa.service.freeipa.user.UserSyncLogEvent.RETRIEVE_FULL_UMS_STATE) UmsEventGenerationIdsProvider(com.sequenceiq.freeipa.service.freeipa.user.ums.UmsEventGenerationIdsProvider) SynchronizationStatus(com.sequenceiq.freeipa.api.v1.freeipa.user.model.SynchronizationStatus) SyncStatusDetail(com.sequenceiq.freeipa.service.freeipa.user.model.SyncStatusDetail) ExecutorService(java.util.concurrent.ExecutorService) Stack(com.sequenceiq.freeipa.entity.Stack) Logger(org.slf4j.Logger) UmsUsersState(com.sequenceiq.freeipa.service.freeipa.user.model.UmsUsersState) UserSyncOptions(com.sequenceiq.freeipa.service.freeipa.user.model.UserSyncOptions) FailureDetails(com.sequenceiq.freeipa.api.v1.freeipa.user.model.FailureDetails) Set(java.util.Set) UserSyncStatus(com.sequenceiq.freeipa.entity.UserSyncStatus) FULL_USER_SYNC(com.sequenceiq.freeipa.service.freeipa.user.UserSyncLogEvent.FULL_USER_SYNC) Collectors(java.util.stream.Collectors) UmsEventGenerationIds(com.sequenceiq.freeipa.service.freeipa.user.model.UmsEventGenerationIds) OperationService(com.sequenceiq.freeipa.service.operation.OperationService) ExecutionException(java.util.concurrent.ExecutionException) TimeUnit(java.util.concurrent.TimeUnit) Json(com.sequenceiq.cloudbreak.common.json.Json) RETRIEVE_PARTIAL_UMS_STATE(com.sequenceiq.freeipa.service.freeipa.user.UserSyncLogEvent.RETRIEVE_PARTIAL_UMS_STATE) List(java.util.List) MDCUtils(com.sequenceiq.cloudbreak.logger.MDCUtils) SuccessDetails(com.sequenceiq.freeipa.api.v1.freeipa.user.model.SuccessDetails) UmsEventGenerationIds(com.sequenceiq.freeipa.service.freeipa.user.model.UmsEventGenerationIds) UmsUsersState(com.sequenceiq.freeipa.service.freeipa.user.model.UmsUsersState)

Aggregations

Multimap (com.google.common.collect.Multimap)1 EntitlementService (com.sequenceiq.cloudbreak.auth.altus.EntitlementService)1 Json (com.sequenceiq.cloudbreak.common.json.Json)1 MDCUtils (com.sequenceiq.cloudbreak.logger.MDCUtils)1 FailureDetails (com.sequenceiq.freeipa.api.v1.freeipa.user.model.FailureDetails)1 SuccessDetails (com.sequenceiq.freeipa.api.v1.freeipa.user.model.SuccessDetails)1 SynchronizationStatus (com.sequenceiq.freeipa.api.v1.freeipa.user.model.SynchronizationStatus)1 UsersyncConfig (com.sequenceiq.freeipa.configuration.UsersyncConfig)1 Stack (com.sequenceiq.freeipa.entity.Stack)1 UserSyncStatus (com.sequenceiq.freeipa.entity.UserSyncStatus)1 FULL_USER_SYNC (com.sequenceiq.freeipa.service.freeipa.user.UserSyncLogEvent.FULL_USER_SYNC)1 PARTIAL_USER_SYNC (com.sequenceiq.freeipa.service.freeipa.user.UserSyncLogEvent.PARTIAL_USER_SYNC)1 RETRIEVE_FULL_UMS_STATE (com.sequenceiq.freeipa.service.freeipa.user.UserSyncLogEvent.RETRIEVE_FULL_UMS_STATE)1 RETRIEVE_PARTIAL_UMS_STATE (com.sequenceiq.freeipa.service.freeipa.user.UserSyncLogEvent.RETRIEVE_PARTIAL_UMS_STATE)1 SyncStatusDetail (com.sequenceiq.freeipa.service.freeipa.user.model.SyncStatusDetail)1 UmsEventGenerationIds (com.sequenceiq.freeipa.service.freeipa.user.model.UmsEventGenerationIds)1 UmsUsersState (com.sequenceiq.freeipa.service.freeipa.user.model.UmsUsersState)1 UserSyncOptions (com.sequenceiq.freeipa.service.freeipa.user.model.UserSyncOptions)1 UmsEventGenerationIdsProvider (com.sequenceiq.freeipa.service.freeipa.user.ums.UmsEventGenerationIdsProvider)1 UmsUsersStateProviderDispatcher (com.sequenceiq.freeipa.service.freeipa.user.ums.UmsUsersStateProviderDispatcher)1