From ec3e221f4eaebde258c44edae99ccb2c3ef075a9 Mon Sep 17 00:00:00 2001 From: shabirmean Date: Wed, 16 Nov 2022 12:17:53 -0500 Subject: [PATCH 1/4] chore: fix samples tests --- .../com/example/vision/ImportProductSets.java | 3 ++- .../vision/ProductInProductSetManagement.java | 14 ++++++-------- .../com/example/vision/ProductManagement.java | 15 +++++++-------- .../java/com/example/vision/ProductSearch.java | 4 ++-- .../com/example/vision/ProductSetManagement.java | 13 +++++++------ .../example/vision/ReferenceImageManagement.java | 7 +++---- 6 files changed, 27 insertions(+), 29 deletions(-) diff --git a/samples/snippets/src/main/java/com/example/vision/ImportProductSets.java b/samples/snippets/src/main/java/com/example/vision/ImportProductSets.java index 9759fe682..bc8c3a263 100644 --- a/samples/snippets/src/main/java/com/example/vision/ImportProductSets.java +++ b/samples/snippets/src/main/java/com/example/vision/ImportProductSets.java @@ -23,6 +23,7 @@ import com.google.cloud.vision.v1.ImportProductSetsGcsSource.Builder; import com.google.cloud.vision.v1.ImportProductSetsInputConfig; import com.google.cloud.vision.v1.ImportProductSetsResponse; +import com.google.cloud.vision.v1.LocationName; import com.google.cloud.vision.v1.ProductSearchClient; import com.google.cloud.vision.v1.ReferenceImage; import java.io.PrintStream; @@ -57,7 +58,7 @@ public static void importProductSets(String projectId, String computeRegion, Str try (ProductSearchClient client = ProductSearchClient.create()) { // A resource that represents Google Cloud Platform location. - String formattedParent = ProductSearchClient.formatLocationName(projectId, computeRegion); + String formattedParent = LocationName.format(projectId, computeRegion); Builder gcsSource = ImportProductSetsGcsSource.newBuilder().setCsvFileUri(gcsUri); // Set the input configuration along with Google Cloud Storage URI diff --git a/samples/snippets/src/main/java/com/example/vision/ProductInProductSetManagement.java b/samples/snippets/src/main/java/com/example/vision/ProductInProductSetManagement.java index 6173df12e..376edef52 100644 --- a/samples/snippets/src/main/java/com/example/vision/ProductInProductSetManagement.java +++ b/samples/snippets/src/main/java/com/example/vision/ProductInProductSetManagement.java @@ -19,6 +19,8 @@ import com.google.cloud.vision.v1.Product; import com.google.cloud.vision.v1.ProductName; import com.google.cloud.vision.v1.ProductSearchClient; +import com.google.cloud.vision.v1.ProductSet; +import com.google.cloud.vision.v1.ProductSetName; import java.io.IOException; import java.io.PrintStream; import net.sourceforge.argparse4j.ArgumentParsers; @@ -52,8 +54,7 @@ public static void addProductToProductSet( try (ProductSearchClient client = ProductSearchClient.create()) { // Get the full path of the product set. - String formattedName = - ProductSearchClient.formatProductSetName(projectId, computeRegion, productSetId); + String formattedName = ProductSetName.format(projectId, computeRegion, productSetId); // Get the full path of the product. String productPath = ProductName.of(projectId, computeRegion, productId).toString(); @@ -80,8 +81,7 @@ public static void listProductsInProductSet( try (ProductSearchClient client = ProductSearchClient.create()) { // Get the full path of the product set. - String formattedName = - ProductSearchClient.formatProductSetName(projectId, computeRegion, productSetId); + String formattedName = ProductSetName.format(projectId, computeRegion, productSetId); // List all the products available in the product set. for (Product product : client.listProductsInProductSet(formattedName).iterateAll()) { // Display the product information @@ -118,12 +118,10 @@ public static void removeProductFromProductSet( try (ProductSearchClient client = ProductSearchClient.create()) { // Get the full path of the product set. - String formattedParent = - ProductSearchClient.formatProductSetName(projectId, computeRegion, productSetId); + String formattedParent = ProductSetName.format(projectId, computeRegion, productSetId); // Get the full path of the product. - String formattedName = - ProductSearchClient.formatProductName(projectId, computeRegion, productId); + String formattedName = ProductName.format(projectId, computeRegion, productId); // Remove the product from the product set. client.removeProductFromProductSet(formattedParent, formattedName); diff --git a/samples/snippets/src/main/java/com/example/vision/ProductManagement.java b/samples/snippets/src/main/java/com/example/vision/ProductManagement.java index 94fb411f4..25217f898 100644 --- a/samples/snippets/src/main/java/com/example/vision/ProductManagement.java +++ b/samples/snippets/src/main/java/com/example/vision/ProductManagement.java @@ -16,8 +16,10 @@ package com.example.vision; +import com.google.cloud.vision.v1.LocationName; import com.google.cloud.vision.v1.Product; import com.google.cloud.vision.v1.Product.KeyValue; +import com.google.cloud.vision.v1.ProductName; import com.google.cloud.vision.v1.ProductSearchClient; import com.google.protobuf.FieldMask; import java.io.IOException; @@ -58,7 +60,7 @@ public static void createProduct( try (ProductSearchClient client = ProductSearchClient.create()) { // A resource that represents Google Cloud Platform location. - String formattedParent = ProductSearchClient.formatLocationName(projectId, computeRegion); + String formattedParent = LocationName.format(projectId, computeRegion); // Create a product with the product specification in the region. // Multiple labels are also supported. Product myProduct = @@ -86,7 +88,7 @@ public static void listProducts(String projectId, String computeRegion) throws I try (ProductSearchClient client = ProductSearchClient.create()) { // A resource that represents Google Cloud Platform location. - String formattedParent = ProductSearchClient.formatLocationName(projectId, computeRegion); + String formattedParent = LocationName.format(projectId, computeRegion); // List all the products available in the region. for (Product product : client.listProducts(formattedParent).iterateAll()) { @@ -120,8 +122,7 @@ public static void getProduct(String projectId, String computeRegion, String pro try (ProductSearchClient client = ProductSearchClient.create()) { // Get the full path of the product. - String formattedName = - ProductSearchClient.formatProductName(projectId, computeRegion, productId); + String formattedName = ProductName.format(projectId, computeRegion, productId); // Get complete detail of the product. Product product = client.getProduct(formattedName); // Display the product information @@ -157,8 +158,7 @@ public static void updateProductLabels( try (ProductSearchClient client = ProductSearchClient.create()) { // Get the full path of the product. - String formattedName = - ProductSearchClient.formatProductName(projectId, computeRegion, productId); + String formattedName = ProductName.format(projectId, computeRegion, productId); // Set product name, product labels and product display name. // Multiple labels are also supported. @@ -201,8 +201,7 @@ public static void deleteProduct(String projectId, String computeRegion, String try (ProductSearchClient client = ProductSearchClient.create()) { // Get the full path of the product. - String formattedName = - ProductSearchClient.formatProductName(projectId, computeRegion, productId); + String formattedName = ProductName.format(projectId, computeRegion, productId); // Delete a product. client.deleteProduct(formattedName); diff --git a/samples/snippets/src/main/java/com/example/vision/ProductSearch.java b/samples/snippets/src/main/java/com/example/vision/ProductSearch.java index 9cd4bca0e..014965144 100644 --- a/samples/snippets/src/main/java/com/example/vision/ProductSearch.java +++ b/samples/snippets/src/main/java/com/example/vision/ProductSearch.java @@ -24,6 +24,7 @@ import com.google.cloud.vision.v1.ImageAnnotatorClient; import com.google.cloud.vision.v1.ImageContext; import com.google.cloud.vision.v1.ImageSource; +import com.google.cloud.vision.v1.ProductName; import com.google.cloud.vision.v1.ProductSearchClient; import com.google.cloud.vision.v1.ProductSearchParams; import com.google.cloud.vision.v1.ProductSearchResults.Result; @@ -76,8 +77,7 @@ public static void getSimilarProductsFile( try (ImageAnnotatorClient queryImageClient = ImageAnnotatorClient.create()) { // Get the full path of the product set. - String productSetPath = - ProductSearchClient.formatProductSetName(projectId, computeRegion, productSetId); + String productSetPath = ProductSetName.format(projectId, computeRegion, productSetId); // Read the image as a stream of bytes. File imgPath = new File(filePath); diff --git a/samples/snippets/src/main/java/com/example/vision/ProductSetManagement.java b/samples/snippets/src/main/java/com/example/vision/ProductSetManagement.java index a6aa33f0d..d277bc1c9 100644 --- a/samples/snippets/src/main/java/com/example/vision/ProductSetManagement.java +++ b/samples/snippets/src/main/java/com/example/vision/ProductSetManagement.java @@ -17,8 +17,11 @@ package com.example.vision; import com.google.cloud.vision.v1.CreateProductSetRequest; +import com.google.cloud.vision.v1.LocationName; +import com.google.cloud.vision.v1.ProductName; import com.google.cloud.vision.v1.ProductSearchClient; import com.google.cloud.vision.v1.ProductSet; +import com.google.cloud.vision.v1.ProductSetName; import java.io.IOException; import java.io.PrintStream; import net.sourceforge.argparse4j.ArgumentParsers; @@ -52,7 +55,7 @@ public static void createProductSet( try (ProductSearchClient client = ProductSearchClient.create()) { // A resource that represents Google Cloud Platform location. - String formattedParent = ProductSearchClient.formatLocationName(projectId, computeRegion); + String formattedParent = LocationName.format(projectId, computeRegion); // Create a product set with the product set specification in the region. ProductSet myProductSet = @@ -81,7 +84,7 @@ public static void createProductSet( public static void listProductSets(String projectId, String computeRegion) throws IOException { try (ProductSearchClient client = ProductSearchClient.create()) { // A resource that represents Google Cloud Platform location. - String formattedParent = ProductSearchClient.formatLocationName(projectId, computeRegion); + String formattedParent = LocationName.format(projectId, computeRegion); // List all the product sets available in the region. for (ProductSet productSet : client.listProductSets(formattedParent).iterateAll()) { // Display the product set information @@ -114,8 +117,7 @@ public static void getProductSet(String projectId, String computeRegion, String try (ProductSearchClient client = ProductSearchClient.create()) { // Get the full path of the product set. - String formattedName = - ProductSearchClient.formatProductSetName(projectId, computeRegion, productSetId); + String formattedName = ProductSetName.format(projectId, computeRegion, productSetId); // Get complete detail of the product set. ProductSet productSet = client.getProductSet(formattedName); // Display the product set information @@ -147,8 +149,7 @@ public static void deleteProductSet(String projectId, String computeRegion, Stri try (ProductSearchClient client = ProductSearchClient.create()) { // Get the full path of the product set. - String formattedName = - ProductSearchClient.formatProductSetName(projectId, computeRegion, productSetId); + String formattedName = ProductSetName.format(projectId, computeRegion, productSetId); // Delete the product set. client.deleteProductSet(formattedName); System.out.println(String.format("Product set deleted")); diff --git a/samples/snippets/src/main/java/com/example/vision/ReferenceImageManagement.java b/samples/snippets/src/main/java/com/example/vision/ReferenceImageManagement.java index 9260d64ae..50df7dbb8 100644 --- a/samples/snippets/src/main/java/com/example/vision/ReferenceImageManagement.java +++ b/samples/snippets/src/main/java/com/example/vision/ReferenceImageManagement.java @@ -17,6 +17,7 @@ package com.example.vision; import com.google.cloud.vision.v1.ImageName; +import com.google.cloud.vision.v1.ProductName; import com.google.cloud.vision.v1.ProductSearchClient; import com.google.cloud.vision.v1.ReferenceImage; import java.io.IOException; @@ -58,8 +59,7 @@ public static void createReferenceImage( try (ProductSearchClient client = ProductSearchClient.create()) { // Get the full path of the product. - String formattedParent = - ProductSearchClient.formatProductName(projectId, computeRegion, productId); + String formattedParent = ProductName.format(projectId, computeRegion, productId); // Create a reference image. ReferenceImage referenceImage = ReferenceImage.newBuilder().setUri(gcsUri).build(); @@ -86,8 +86,7 @@ public static void listReferenceImagesOfProduct( try (ProductSearchClient client = ProductSearchClient.create()) { // Get the full path of the product. - String formattedParent = - ProductSearchClient.formatProductName(projectId, computeRegion, productId); + String formattedParent = ProductName.format(projectId, computeRegion, productId); for (ReferenceImage image : client.listReferenceImages(formattedParent).iterateAll()) { // Display the reference image information. System.out.println(String.format("Reference image name: %s", image.getName())); From d4000b2209aa40413d5850c000477100ab39a98e Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 16 Nov 2022 17:21:28 +0000 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- README.md | 4 ++-- .../com/example/vision/ProductInProductSetManagement.java | 1 - .../src/main/java/com/example/vision/ProductSearch.java | 2 -- .../main/java/com/example/vision/ProductSetManagement.java | 1 - 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c33110964..f6d78ba98 100644 --- a/README.md +++ b/README.md @@ -64,13 +64,13 @@ implementation 'com.google.cloud:google-cloud-vision' If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-vision:3.3.0' +implementation 'com.google.cloud:google-cloud-vision:3.4.0' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-vision" % "3.3.0" +libraryDependencies += "com.google.cloud" % "google-cloud-vision" % "3.4.0" ``` ## Authentication diff --git a/samples/snippets/src/main/java/com/example/vision/ProductInProductSetManagement.java b/samples/snippets/src/main/java/com/example/vision/ProductInProductSetManagement.java index 376edef52..11d21ebf3 100644 --- a/samples/snippets/src/main/java/com/example/vision/ProductInProductSetManagement.java +++ b/samples/snippets/src/main/java/com/example/vision/ProductInProductSetManagement.java @@ -19,7 +19,6 @@ import com.google.cloud.vision.v1.Product; import com.google.cloud.vision.v1.ProductName; import com.google.cloud.vision.v1.ProductSearchClient; -import com.google.cloud.vision.v1.ProductSet; import com.google.cloud.vision.v1.ProductSetName; import java.io.IOException; import java.io.PrintStream; diff --git a/samples/snippets/src/main/java/com/example/vision/ProductSearch.java b/samples/snippets/src/main/java/com/example/vision/ProductSearch.java index 014965144..cd201275a 100644 --- a/samples/snippets/src/main/java/com/example/vision/ProductSearch.java +++ b/samples/snippets/src/main/java/com/example/vision/ProductSearch.java @@ -24,8 +24,6 @@ import com.google.cloud.vision.v1.ImageAnnotatorClient; import com.google.cloud.vision.v1.ImageContext; import com.google.cloud.vision.v1.ImageSource; -import com.google.cloud.vision.v1.ProductName; -import com.google.cloud.vision.v1.ProductSearchClient; import com.google.cloud.vision.v1.ProductSearchParams; import com.google.cloud.vision.v1.ProductSearchResults.Result; import com.google.cloud.vision.v1.ProductSetName; diff --git a/samples/snippets/src/main/java/com/example/vision/ProductSetManagement.java b/samples/snippets/src/main/java/com/example/vision/ProductSetManagement.java index d277bc1c9..61d218e2c 100644 --- a/samples/snippets/src/main/java/com/example/vision/ProductSetManagement.java +++ b/samples/snippets/src/main/java/com/example/vision/ProductSetManagement.java @@ -18,7 +18,6 @@ import com.google.cloud.vision.v1.CreateProductSetRequest; import com.google.cloud.vision.v1.LocationName; -import com.google.cloud.vision.v1.ProductName; import com.google.cloud.vision.v1.ProductSearchClient; import com.google.cloud.vision.v1.ProductSet; import com.google.cloud.vision.v1.ProductSetName; From 00be401712e85d240f09591869a8548661a58031 Mon Sep 17 00:00:00 2001 From: shabirmean Date: Fri, 18 Nov 2022 16:50:29 -0500 Subject: [PATCH 3/4] chore: bump shared-config versions --- README.md | 4 ++-- google-cloud-vision-bom/pom.xml | 2 +- pom.xml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c33110964..f6d78ba98 100644 --- a/README.md +++ b/README.md @@ -64,13 +64,13 @@ implementation 'com.google.cloud:google-cloud-vision' If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-vision:3.3.0' +implementation 'com.google.cloud:google-cloud-vision:3.4.0' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-vision" % "3.3.0" +libraryDependencies += "com.google.cloud" % "google-cloud-vision" % "3.4.0" ``` ## Authentication diff --git a/google-cloud-vision-bom/pom.xml b/google-cloud-vision-bom/pom.xml index 432381d1f..e49756c66 100644 --- a/google-cloud-vision-bom/pom.xml +++ b/google-cloud-vision-bom/pom.xml @@ -8,7 +8,7 @@ com.google.cloud google-cloud-shared-config - 1.5.3 + 1.5.4 Google Cloud Vision BOM diff --git a/pom.xml b/pom.xml index 89d79ca41..c26035d38 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ com.google.cloud google-cloud-shared-config - 1.5.3 + 1.5.4 @@ -117,7 +117,7 @@ com.google.cloud google-cloud-shared-dependencies - 3.0.4 + 3.0.5 pom import From 0f9814d90b711d616029b06c887bca78652139bb Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 18 Nov 2022 21:53:33 +0000 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f6d78ba98..011670c5b 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ If you are using Maven without BOM, add this to your dependencies: If you are using Gradle 5.x or later, add this to your dependencies: ```Groovy -implementation platform('com.google.cloud:libraries-bom:26.1.4') +implementation platform('com.google.cloud:libraries-bom:26.1.5') implementation 'com.google.cloud:google-cloud-vision' ```