-
Notifications
You must be signed in to change notification settings - Fork 1.1k
demo: regenerated biglake client library #12968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
cb3bfe5
86c7959
82595e6
4c71959
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -114,8 +114,8 @@ public class HttpJsonIcebergCatalogServiceStub extends IcebergCatalogServiceStub | |||||||||
| Map<String, List<String>> fields = new HashMap<>(); | ||||||||||
| ProtoRestSerializer<ListIcebergCatalogsRequest> serializer = | ||||||||||
| ProtoRestSerializer.create(); | ||||||||||
| serializer.putQueryParam(fields, "pageSize", request.getPageSize()); | ||||||||||
| serializer.putQueryParam(fields, "pageToken", request.getPageToken()); | ||||||||||
| serializer.putQueryParam(fields, "page-size", request.getPageSize()); | ||||||||||
| serializer.putQueryParam(fields, "page-token", request.getPageToken()); | ||||||||||
|
Comment on lines
+117
to
+118
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The query parameters
Suggested change
References
|
||||||||||
| serializer.putQueryParam(fields, "view", request.getViewValue()); | ||||||||||
| serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); | ||||||||||
| return fields; | ||||||||||
|
|
@@ -195,7 +195,7 @@ public class HttpJsonIcebergCatalogServiceStub extends IcebergCatalogServiceStub | |||||||||
| ProtoRestSerializer<CreateIcebergCatalogRequest> serializer = | ||||||||||
| ProtoRestSerializer.create(); | ||||||||||
| serializer.putQueryParam( | ||||||||||
| fields, "icebergCatalogId", request.getIcebergCatalogId()); | ||||||||||
| fields, "iceberg-catalog-id", request.getIcebergCatalogId()); | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The query parameter
Suggested change
References
|
||||||||||
| serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); | ||||||||||
| return fields; | ||||||||||
| }) | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| /* | ||
| * Copyright 2026 Google LLC | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package com.google.cloud.biglake.v1; | ||
|
|
||
| import com.google.cloud.biglake.hive.v1beta.CreateHiveCatalogRequest; | ||
| import com.google.cloud.biglake.hive.v1beta.HiveCatalog; | ||
| import com.google.cloud.biglake.hive.v1beta.HiveMetastoreServiceClient; | ||
| import com.google.cloud.biglake.hive.v1beta.HiveMetastoreServiceSettings; | ||
| import com.google.cloud.biglake.hive.v1beta.ListHiveCatalogsRequest; | ||
| import java.io.IOException; | ||
| import org.junit.Test; | ||
|
|
||
| public class BiglakeDemoTest { | ||
|
|
||
| @Test | ||
| public void testBiglakeRequests() throws Exception { | ||
| String projectId = System.getenv("GOOGLE_CLOUD_PROJECT"); | ||
| if (projectId == null || projectId.isEmpty()) { | ||
| System.err.println( | ||
| "Warning: GOOGLE_CLOUD_PROJECT environment variable not defined. Skipping demo requests."); | ||
| return; | ||
| } | ||
|
|
||
| System.out.println("Starting BigLake Client library demo execution..."); | ||
| System.out.println("Target Project ID: " + projectId); | ||
|
|
||
| runHiveMetastoreDemo(projectId); | ||
| runIcebergCatalogDemo(projectId); | ||
| } | ||
|
|
||
| private void runHiveMetastoreDemo(String projectId) throws IOException { | ||
| System.out.println("\nExecuting Hive Metastore affected requests test..."); | ||
| HiveMetastoreServiceSettings settings = | ||
| HiveMetastoreServiceSettings.newHttpJsonBuilder().build(); | ||
|
|
||
| try (HiveMetastoreServiceClient client = HiveMetastoreServiceClient.create(settings)) { | ||
| String parent = String.format("projects/%s", projectId); | ||
|
|
||
| // Call ListHiveCatalogsRequest verifying corrected query parameters | ||
| System.out.println("Requesting ListHiveCatalogs..."); | ||
| ListHiveCatalogsRequest listRequest = | ||
| ListHiveCatalogsRequest.newBuilder().setParent(parent).setPageSize(10).build(); | ||
|
|
||
| client | ||
| .listHiveCatalogs(listRequest) | ||
| .iterateAll() | ||
| .forEach(catalog -> System.out.println(" -> Found Catalog: " + catalog.getName())); | ||
|
|
||
| // Call CreateHiveCatalogRequest verifying query parameter primary_location serialization | ||
| System.out.println("Requesting CreateHiveCatalog (dry-run / testing)..."); | ||
| CreateHiveCatalogRequest createRequest = | ||
| CreateHiveCatalogRequest.newBuilder() | ||
| .setParent(parent) | ||
| .setHiveCatalogId("test-demo-catalog-" + System.currentTimeMillis()) | ||
| .setPrimaryLocation("us-central1") | ||
| .setHiveCatalog(HiveCatalog.newBuilder().build()) | ||
| .build(); | ||
|
|
||
| HiveCatalog response = client.createHiveCatalog(createRequest); | ||
| System.out.println(" -> Successfully Created Catalog: " + response.getName()); | ||
| } | ||
| } | ||
|
|
||
| private void runIcebergCatalogDemo(String projectId) throws IOException { | ||
| System.out.println("\nExecuting Iceberg Catalog affected requests test..."); | ||
| IcebergCatalogServiceSettings settings = | ||
| IcebergCatalogServiceSettings.newHttpJsonBuilder().build(); | ||
|
|
||
| try (IcebergCatalogServiceClient client = IcebergCatalogServiceClient.create(settings)) { | ||
| String parent = String.format("projects/%s", projectId); | ||
|
|
||
| // Call ListIcebergCatalogsRequest verifying corrected query parameters | ||
| System.out.println("Requesting ListIcebergCatalogs..."); | ||
| ListIcebergCatalogsRequest listRequest = | ||
| ListIcebergCatalogsRequest.newBuilder().setParent(parent).setPageSize(10).build(); | ||
|
|
||
| client | ||
| .listIcebergCatalogs(listRequest) | ||
| .iterateAll() | ||
| .forEach( | ||
| catalog -> System.out.println(" -> Found Iceberg Catalog: " + catalog.getName())); | ||
|
|
||
| // Call CreateIcebergCatalogRequest verifying corrected parameter | ||
| System.out.println("Requesting CreateIcebergCatalog..."); | ||
| CreateIcebergCatalogRequest createRequest = | ||
| CreateIcebergCatalogRequest.newBuilder() | ||
| .setParent(parent) | ||
| .setIcebergCatalogId("test-demo-iceberg-" + System.currentTimeMillis()) | ||
| .setIcebergCatalog(IcebergCatalog.newBuilder().build()) | ||
| .build(); | ||
|
|
||
| IcebergCatalog response = client.createIcebergCatalog(createRequest); | ||
| System.out.println(" -> Successfully Created Iceberg Catalog: " + response.getName()); | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The query parameter name has been changed from
primaryLocationtoprimary_location. While breaking changes are permissible for unreleased APIs, this snake_case naming is inconsistent with the kebab-case naming (e.g.,page-size) introduced inHttpJsonIcebergCatalogServiceStub.java. Standardizing on camelCase is recommended for Google Cloud APIs.References