GeezerVison is showing github.com — Ability to list projects with BigQuery · Issue #3087 · googleapis/google-cloud-java
Ability to list projects with BigQuery #3087DescriptionHello,
I would like to have ability to list all projects where BIgQuery is enabled and I (as a user or service account) have required permissions.
This functionality corresponds with biqquery.projects.list api call.
I have an use case, when I want to perform some actions on tables in all projects accessible for me.
Ability to create BIgQuery services for each accessible project would be great. ActivityMMMarcy commented on May 16, 2018 Having a go at this.
I have a working implementation (see this commit) that follows the format of listDatasets.
If you think it's valid, feel free to assign to me and I will finalize the Project class following the Dataset.java (and DatasetId, DatasetInfo) format and add tests. radkomateusz commented on Jun 1, 2018 Hello, my apologies for the slow reply.
For me it looks good, the usage mentioned in javadoc in your commit:
Page<Project> projects = bigQuery.listProjects(); for (Project project: projects.iterateAll()) { // do something with the project }
is exactly what I'm looking for. radkomateusz commented on Jun 1, 2018 I'm just wondering:
maybe it will be good to have possibility to list dataset also from project level:
Project gcpProjectWithBQ = <project object>; Page<Dataset> datasets = gcpProjectWithBQ.list()
next to current option biqQuery.listDatasets(projectId).
It would be consistent with Dataset implementation which allows me to call Page<Table> tablePage = dataset.list() shollyman commented on Sep 26, 2018 marcin-kolda commented on Sep 27, 2018 Hi @shollyman,
Resource Manager API works fine if you have resourcemanager.projects.list permission on a project. It won't work if you have permissions specified in dataset ACL (i.e. dataset primitive roles). In such case only biqquery.projects.list API will return such project. shollyman commented on Sep 27, 2018 Hello @marcin-kolda!
bigquery.projects.list currently uses the resourcemanager API as part of its internal implementation. Neither endpoint will return projects where the caller has no permissions at the project (or higher) level of the resource hierarchy. That permission doesn't need to be BQ-related, but there does need to be a permission or role assigned at the project level for the project to be included.
marcin-kolda commented on Sep 27, 2018 Yes, you're right @shollyman. I just tested it and bigquery.projects.list doesn't return projects in which you have only access to datasets. I'm pretty sure that it was working like that some time ago :) shollyman commented on Sep 27, 2018 Improving resource discovery is a larger problem that's being worked on, but that's outside the scope of these project enumeration methods. shollyman commented on Sep 28, 2018 Based on the discussion, closing this FR.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|