From 759af1c4a59dcb5c4b3fad4d02bcc2da60d0e252 Mon Sep 17 00:00:00 2001 From: Sita Lakshmi Sangameswaran Date: Sat, 12 Nov 2022 04:28:28 +0530 Subject: [PATCH 1/7] chore: removed migrated samples --- samples/snippets/pom.xml | 60 ------------------- .../main/java/webrisk/SearchUriExample.java | 53 ---------------- .../main/java/webrisk/SubmitUriExample.java | 49 --------------- .../java/webrisk/SearchUriExampleTest.java | 47 --------------- .../java/webrisk/SubmitUriExampleTest.java | 31 ---------- 5 files changed, 240 deletions(-) delete mode 100644 samples/snippets/pom.xml delete mode 100644 samples/snippets/src/main/java/webrisk/SearchUriExample.java delete mode 100644 samples/snippets/src/main/java/webrisk/SubmitUriExample.java delete mode 100644 samples/snippets/src/test/java/webrisk/SearchUriExampleTest.java delete mode 100644 samples/snippets/src/test/java/webrisk/SubmitUriExampleTest.java diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml deleted file mode 100644 index 38f5bb97..00000000 --- a/samples/snippets/pom.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - 4.0.0 - com.google.cloud - webrisk-snippets - jar - Google Web Risk Snippets - https://github.com/googleapis/java-webrisk - - - - com.google.cloud.samples - shared-configuration - 1.2.0 - - - - 1.8 - 1.8 - UTF-8 - - - - - - - - com.google.cloud - libraries-bom - 26.1.4 - pom - import - - - - - - - com.google.cloud - google-cloud-webrisk - - - - - junit - junit - 4.13.2 - test - - - com.google.truth - truth - 1.1.3 - test - - - diff --git a/samples/snippets/src/main/java/webrisk/SearchUriExample.java b/samples/snippets/src/main/java/webrisk/SearchUriExample.java deleted file mode 100644 index 3791a305..00000000 --- a/samples/snippets/src/main/java/webrisk/SearchUriExample.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2020 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 - * - * http://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 webrisk; - -import com.google.cloud.webrisk.v1.WebRiskServiceClient; -import com.google.webrisk.v1.SearchUrisRequest; -import com.google.webrisk.v1.SearchUrisResponse; -import com.google.webrisk.v1.ThreatType; -import java.io.IOException; - -public class SearchUriExample { - - public static void searchUriExample() throws IOException { - // The URL to be searched - String uri = "http://testsafebrowsing.appspot.com/s/malware.html"; - SearchUrisResponse response = searchUriExample(uri); - } - - // [START webrisk_search_uri] - public static SearchUrisResponse searchUriExample(String uri) throws IOException { - // create-webrisk-client - try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) { - // Query the url for a specific threat type - SearchUrisRequest searchUrisRequest = - SearchUrisRequest.newBuilder().addThreatTypes(ThreatType.MALWARE).setUri(uri).build(); - SearchUrisResponse searchUrisResponse = webRiskServiceClient.searchUris(searchUrisRequest); - webRiskServiceClient.shutdownNow(); - if (!searchUrisResponse.getThreat().getThreatTypesList().isEmpty()) { - System.out.println("The URL has the following threat : "); - System.out.println(searchUrisResponse); - } else { - System.out.println("The URL is safe!"); - } - - return searchUrisResponse; - } - } - // [END webrisk_search_uri] -} diff --git a/samples/snippets/src/main/java/webrisk/SubmitUriExample.java b/samples/snippets/src/main/java/webrisk/SubmitUriExample.java deleted file mode 100644 index 93fb5604..00000000 --- a/samples/snippets/src/main/java/webrisk/SubmitUriExample.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2020 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 - * - * http://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 webrisk; - -import com.google.cloud.webrisk.v1.WebRiskServiceClient; -import com.google.webrisk.v1.CreateSubmissionRequest; -import com.google.webrisk.v1.Submission; -import java.io.IOException; - -public class SubmitUriExample { - - public static void submitUriExample() throws IOException { - // The URL to be submitted - String uri = "http://testsafebrowsing.appspot.com/s/malware.html"; - Submission response = submitUriExample(uri); - } - - // [START webrisk_submit_uri] - public static Submission submitUriExample(String uri) throws IOException { - // create-webrisk-client - try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) { - Submission submission = Submission.newBuilder().setUri(uri).build(); - CreateSubmissionRequest submissionRequest = - CreateSubmissionRequest.newBuilder() - .setParent("projects/your-project-id") - .setSubmission(submission) - .build(); - Submission submissionResponse = webRiskServiceClient.createSubmission(submissionRequest); - webRiskServiceClient.shutdownNow(); - System.out.println("The submitted " + submissionResponse); - return submissionResponse; - } - } - // [END webrisk_submit_uri] -} diff --git a/samples/snippets/src/test/java/webrisk/SearchUriExampleTest.java b/samples/snippets/src/test/java/webrisk/SearchUriExampleTest.java deleted file mode 100644 index 0483a1d0..00000000 --- a/samples/snippets/src/test/java/webrisk/SearchUriExampleTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2020 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 - * - * http://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 webrisk; - -import com.google.common.truth.Truth; -import com.google.webrisk.v1.SearchUrisResponse; -import com.google.webrisk.v1.ThreatType; -import java.io.IOException; -import java.util.List; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -@RunWith(JUnit4.class) -public class SearchUriExampleTest { - @Test - public void testSearchWithThreat() throws IOException { - // The URL to be searched - String uri = "http://testsafebrowsing.appspot.com/s/malware.html"; - SearchUrisResponse actualResponse = SearchUriExample.searchUriExample(uri); - List type = actualResponse.getThreat().getThreatTypesList(); - Truth.assertThat(type).contains(ThreatType.MALWARE); - } - - @Test - public void testSearchWithoutThreat() throws IOException { - // The URL to be searched - String uri = "http://testsafebrowsing.appspot.com/malware.html"; - SearchUrisResponse actualResponse = SearchUriExample.searchUriExample(uri); - List type = actualResponse.getThreat().getThreatTypesList(); - Truth.assertThat(type).isEmpty(); - } -} diff --git a/samples/snippets/src/test/java/webrisk/SubmitUriExampleTest.java b/samples/snippets/src/test/java/webrisk/SubmitUriExampleTest.java deleted file mode 100644 index 6d7c2fba..00000000 --- a/samples/snippets/src/test/java/webrisk/SubmitUriExampleTest.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2020 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 - * - * http://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 webrisk; - -import com.google.common.truth.Truth; -import com.google.webrisk.v1.Submission; -import java.io.IOException; -import org.junit.Test; - -public class SubmitUriExampleTest { - @Test - public void testSumbitUriExample() throws IOException { - String testUri = "http://testsafebrowsing.appspot.com/s/malware.html"; - Submission actualSubmission = SubmitUriExample.submitUriExample(testUri); - Truth.assertThat(actualSubmission.getUri()).isEqualTo(testUri); - } -} From 8b6862533a1b9f285863af4d5b99fee2024c2421 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 11 Nov 2022 23:01:57 +0000 Subject: [PATCH 2/7] =?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 | 41 +---------------------------------- samples/snippets/pom.xml | 47 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 40 deletions(-) create mode 100644 samples/snippets/pom.xml diff --git a/README.md b/README.md index 6b3daa8c..74d9080f 100644 --- a/README.md +++ b/README.md @@ -18,30 +18,8 @@ The Maven artifact coordinates (`com.google.cloud:google-cloud-webrisk`) remain ## Quickstart -If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file: -```xml - - - - com.google.cloud - libraries-bom - 26.1.4 - pom - import - - - - - - - com.google.cloud - google-cloud-webrisk - - -``` - -If you are using Maven without BOM, add this to your dependencies: +If you are using Maven, add this to your pom.xml file: ```xml @@ -53,13 +31,6 @@ 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 'com.google.cloud:google-cloud-webrisk' -``` If you are using Gradle without BOM, add this to your dependencies: ```Groovy @@ -107,16 +78,6 @@ use this Web Risk Client Library. -## Samples - -Samples are in the [`samples/`](https://github.com/googleapis/java-webrisk/tree/main/samples) directory. - -| Sample | Source Code | Try it | -| --------------------------- | --------------------------------- | ------ | -| Search Uri Example | [source code](https://github.com/googleapis/java-webrisk/blob/main/samples/snippets/src/main/java/webrisk/SearchUriExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-webrisk&page=editor&open_in_editor=samples/snippets/src/main/java/webrisk/SearchUriExample.java) | -| Submit Uri Example | [source code](https://github.com/googleapis/java-webrisk/blob/main/samples/snippets/src/main/java/webrisk/SubmitUriExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-webrisk&page=editor&open_in_editor=samples/snippets/src/main/java/webrisk/SubmitUriExample.java) | - - ## Troubleshooting diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml new file mode 100644 index 00000000..f0e5f7c3 --- /dev/null +++ b/samples/snippets/pom.xml @@ -0,0 +1,47 @@ + + + 4.0.0 + com.google.cloud + -snippets + jar + Google Web Risk Snippets + https://github.com/googleapis/java-webrisk + + + + com.google.cloud.samples + shared-configuration + 1.2.0 + + + + 1.8 + 1.8 + UTF-8 + + + + + + com.google.cloud + google-cloud-webrisk + 2.4.0 + + + + junit + junit + 4.13.2 + test + + + com.google.truth + truth + 1.1.3 + test + + + From e31362ed428731184dc7013d4f875b7a81c30ff2 Mon Sep 17 00:00:00 2001 From: SitaLakshmi Date: Tue, 15 Nov 2022 13:41:48 +0530 Subject: [PATCH 3/7] reverting owlbot changes --- samples/snippets/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index f0e5f7c3..c3efc775 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.google.cloud - -snippets + webrisk-snippets jar Google Web Risk Snippets https://github.com/googleapis/java-webrisk From e95403b95423a9e3c2141db1fd3041a1465e5c89 Mon Sep 17 00:00:00 2001 From: SitaLakshmi Date: Tue, 15 Nov 2022 13:45:02 +0530 Subject: [PATCH 4/7] update pom --- samples/snippets/pom.xml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index c3efc775..846d735e 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -9,7 +9,7 @@ com.google.cloud.samples @@ -23,13 +23,27 @@ UTF-8 + + + + + + com.google.cloud + libraries-bom + 26.1.4 + pom + import + + + + com.google.cloud google-cloud-webrisk - 2.4.0 + junit From 251c54f0ca2d3d1aeb2d5db3ceb2055186d73af6 Mon Sep 17 00:00:00 2001 From: SitaLakshmi Date: Tue, 15 Nov 2022 13:45:46 +0530 Subject: [PATCH 5/7] update pom --- samples/snippets/pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index 846d735e..38f5bb97 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -38,7 +38,6 @@ - com.google.cloud google-cloud-webrisk From 1a8519a27958c94425b515facca219412eaec039 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 15 Nov 2022 08:17:30 +0000 Subject: [PATCH 6/7] =?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 | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 74d9080f..6e9f69f7 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,31 @@ The Maven artifact coordinates (`com.google.cloud:google-cloud-webrisk`) remain ## Quickstart +If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file: -If you are using Maven, add this to your pom.xml file: +```xml + + + + com.google.cloud + libraries-bom + 26.1.4 + pom + import + + + + + + + + com.google.cloud + google-cloud-webrisk + + +``` + +If you are using Maven without BOM, add this to your dependencies: ```xml @@ -31,6 +54,13 @@ If you are using Maven, add this to your pom.xml file: ``` +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 'com.google.cloud:google-cloud-webrisk' +``` If you are using Gradle without BOM, add this to your dependencies: ```Groovy From cd9397735f963c786045010c183f4c8a7e75e239 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 15 Nov 2022 08:19:48 +0000 Subject: [PATCH 7/7] =?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 | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 6e9f69f7..2264c051 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,6 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file: - com.google.cloud google-cloud-webrisk