use of com.sequenceiq.freeipa.entity.UserSyncStatus in project cloudbreak by hortonworks.
the class UserSyncPoller method syncFreeIpaStacksInAccount.
private void syncFreeIpaStacksInAccount(Optional<String> requestId, String accountId, List<Stack> stacks) {
Instant cooldownThresholdTime = Instant.now().minus(cooldown);
UmsEventGenerationIds currentGeneration = umsEventGenerationIdsProvider.getEventGenerationIds(accountId, requestId);
stacks.forEach(stack -> {
UserSyncStatus userSyncStatus = userSyncStatusService.getOrCreateForStack(stack);
if (!eventGenerationIdsChecker.isInSync(userSyncStatus, currentGeneration) && cooldownChecker.isCooldownExpired(userSyncStatus, cooldownThresholdTime)) {
LOGGER.debug("Environment {} in Account {} is not in sync.", stack.getEnvironmentCrn(), stack.getAccountId());
Operation operation = userSyncService.synchronizeUsers(stack.getAccountId(), regionAwareInternalCrnGeneratorFactory.iam().getInternalCrnForServiceAsString(), Set.of(stack.getEnvironmentCrn()), Set.of(), Set.of(), WorkloadCredentialsUpdateType.UPDATE_IF_CHANGED);
LOGGER.debug("User Sync request resulted in operation {}", operation);
} else {
LOGGER.debug("Environment {} in Account {} is in sync or has been synchronized recently.", stack.getEnvironmentCrn(), stack.getAccountId());
}
});
}
Aggregations