feat(bigquery): add internal listProjects API to core client#13429
feat(bigquery): add internal listProjects API to core client#13429keshavdandeva wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the ability to list Google Cloud Projects accessible to the caller. It adds a new Project model class, a ProjectListOption class for pagination options, and the listProjects method to the BigQuery interface and its implementation BigQueryImpl. It also updates the underlying RPC layer (BigQueryRpc and HttpBigQueryRpc) to support the new API call with OpenTelemetry tracing, and includes corresponding unit tests. There are no review comments to address.
| import java.util.Objects; | ||
|
|
||
| @BetaApi | ||
| public class Project implements Serializable { |
There was a problem hiding this comment.
Can you add some documentation that this is a wrapper for Projects: https://docs.cloud.google.com/bigquery/docs/reference/rest/v2/projects/list.
I think something similar to
| public String getId() { | ||
| return id; | ||
| } | ||
|
|
||
| public String getNumericId() { | ||
| return numericId; | ||
| } | ||
|
|
||
| public String getProjectId() { | ||
| return projectId; | ||
| } | ||
|
|
||
| public String getFriendlyName() { | ||
| return friendlyName; | ||
| } |
There was a problem hiding this comment.
for these public getters can you add a small javadoc section?
| this.id = id; | ||
| this.numericId = numericId; | ||
| this.projectId = projectId; |
There was a problem hiding this comment.
qq, what is the difference between id, numericId, and projectId?
From the link (https://docs.cloud.google.com/bigquery/docs/reference/rest/v2/projects/list), I see id and numericId, but not projectId
|
|
||
| /** Class for specifying project list options. */ | ||
| class ProjectListOption extends Option { | ||
| private static final long serialVersionUID = 1L; |
There was a problem hiding this comment.
I don't think this should be too impactful otherwise, but you can have intellij autogenerate a value for this?
| * @param options options for listing projects | ||
| * @return a page of projects | ||
| */ | ||
| @InternalApi |
There was a problem hiding this comment.
hmm, I think this is an offical BigQuery api (https://docs.cloud.google.com/bigquery/docs/reference/rest/v2/projects/list) and we probably don't need to add InternalApi here.
b/521443900
This PR introduces support for fetching a list of GCP projects via the BigQuery API. This functionality is being exposed primarily to support cross-project dataset resolution in the native BigQuery JDBC driver.
Changes included:
Projectdomain model representing a BigQuery project (@BetaApi).listProjects(ProjectListOption... options)to theBigQueryclient interface, marked as@InternalApito preserve the public GA surface.listProjectsmapping toBigQueryRpcand implemented the underlying HTTP execution inHttpBigQueryRpc, including pagination and OpenTelemetry tracing support.ProjectPageFetcherinsideBigQueryImplto seamlessly handle paginated project results.BigQueryImplTestandHttpBigQueryRpcTest.