class RangerCloudIdentityService {

    private RangerCloudIdentitySyncStatus setAzureCloudIdentityMapping(String envCrn, SdxCluster sdxCluster, Map<String, String> azureUserMapping) {
        String stackCrn = sdxCluster.getStackCrn();
        LOGGER.info("Updating azure cloud id mappings for envCrn = {}, datalake stack crn = {}", envCrn, stackCrn);
        try {
            if (!clouderaManagerRangerUtil.isCloudIdMappingSupported(sdxCluster.getStackCrn())) {
                return newSyncStatus(RangerCloudIdentitySyncState.NOT_APPLICABLE,
                        "The datalake does not support cloud identity sync. Sync request is ignored.");
            }
            Optional<ApiCommand> apiCommand = clouderaManagerRangerUtil.setAzureCloudIdentityMapping(stackCrn, azureUserMapping);
            if (apiCommand.isEmpty()) {
                return newSyncStatus(RangerCloudIdentitySyncState.SUCCESS, "Sucessfully synced, no role refresh required");
            }
            return toRangerCloudIdentitySyncStatus(apiCommand.get());
        } catch (ApiException e) {
            LOGGER.error("Encountered api exception", e);
            return newSyncStatus(RangerCloudIdentitySyncState.FAILED, "Encountered cloudera manager api exception");
        }
    }

}