public List listTablesInScope()

in services/library/src/main/java/com/google/cloud/pso/bq_snapshot_manager/functions/f01_dispatcher/BigQueryScopeLister.java [80:135]


    public List<TableSpec> listTablesInScope(BigQueryScope bqScope) throws NonRetryableApplicationException {

        List<TableSpec> tablesInScope;

        // Pre-compile all regular expressions in exclude lists to improve performance
        List<Pattern> tableExcludeListPatterns = extractAndCompilePatterns(bqScope.getTableExcludeList(), REGEX_PREFIX);
        List<Pattern> datasetExcludeListPatterns = extractAndCompilePatterns(bqScope.getDatasetExcludeList(), REGEX_PREFIX);
        List<Pattern> projectExcludeListPatterns = extractAndCompilePatterns(bqScope.getProjectExcludeList(), REGEX_PREFIX);

        if (!bqScope.getTableIncludeList().isEmpty()) {
            tablesInScope = processTables(
                    bqScope.getTableIncludeList(),
                    bqScope.getTableExcludeList(),
                    tableExcludeListPatterns
            );
        } else {

            if (!bqScope.getDatasetIncludeList().isEmpty()) {
                tablesInScope = processDatasets(
                        bqScope.getDatasetIncludeList(),
                        bqScope.getDatasetExcludeList(),
                        bqScope.getTableExcludeList(),
                        datasetExcludeListPatterns,
                        tableExcludeListPatterns
                );
            } else {
                if (!bqScope.getProjectIncludeList().isEmpty()) {
                    tablesInScope = processProjects(
                            bqScope.getProjectIncludeList(),
                            bqScope.getProjectExcludeList(),
                            bqScope.getDatasetExcludeList(),
                            bqScope.getTableExcludeList(),
                            projectExcludeListPatterns,
                            datasetExcludeListPatterns,
                            tableExcludeListPatterns
                    );
                } else {
                    if (!bqScope.getFolderIncludeList().isEmpty()) {
                        tablesInScope = processFolders(
                                bqScope.getFolderIncludeList(),
                                bqScope.getProjectExcludeList(),
                                bqScope.getDatasetExcludeList(),
                                bqScope.getTableExcludeList(),
                                projectExcludeListPatterns,
                                datasetExcludeListPatterns,
                                tableExcludeListPatterns
                        );
                    } else {
                        throw new NonRetryableApplicationException("At least one of of the following params must be not empty [tableIncludeList, datasetIncludeList, projectIncludeList, folderIncludeList]");
                    }
                }
            }
        }

        return tablesInScope;
    }