From dd5ddbaa668f90cd6698ffd0accfde1168f64b6d Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 22 May 2023 15:37:29 -0400 Subject: [PATCH] feat: [webrisk] add SubmitUri endpoint (#9443) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add SubmitUri endpoint PiperOrigin-RevId: 533110799 Source-Link: https://github.com/googleapis/googleapis/commit/3f5d0c91f96df8666fd4c58e5aad6d4e17469f9e Source-Link: https://github.com/googleapis/googleapis-gen/commit/530de5758e4e2cdb6af6d0cab7ad829171142a1f Copy-Tag: eyJwIjoiamF2YS13ZWJyaXNrLy5Pd2xCb3QueWFtbCIsImgiOiI1MzBkZTU3NThlNGUyY2RiNmFmNmQwY2FiN2FkODI5MTcxMTQyYTFmIn0= * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- java-webrisk/README.md | 4 +- .../webrisk/v1/WebRiskServiceClient.java | 147 + .../webrisk/v1/WebRiskServiceSettings.java | 26 + .../cloud/webrisk/v1/gapic_metadata.json | 3 + .../v1/stub/GrpcWebRiskServiceStub.java | 45 + .../v1/stub/HttpJsonWebRiskServiceStub.java | 108 +- .../webrisk/v1/stub/WebRiskServiceStub.java | 22 + .../v1/stub/WebRiskServiceStubSettings.java | 80 +- .../webrisk/v1/MockWebRiskServiceImpl.java | 22 + .../v1/WebRiskServiceClientHttpJsonTest.java | 80 +- .../webrisk/v1/WebRiskServiceClientTest.java | 81 +- .../google/webrisk/v1/WebRiskServiceGrpc.java | 142 + .../v1/ComputeThreatListDiffRequest.java | 42 +- ...ComputeThreatListDiffRequestOrBuilder.java | 12 +- .../webrisk/v1/CreateSubmissionRequest.java | 28 +- .../v1/CreateSubmissionRequestOrBuilder.java | 8 +- .../webrisk/v1/SearchHashesRequest.java | 51 +- .../v1/SearchHashesRequestOrBuilder.java | 15 +- .../google/webrisk/v1/SearchUrisRequest.java | 51 +- .../v1/SearchUrisRequestOrBuilder.java | 15 +- .../com/google/webrisk/v1/Submission.java | 473 +- .../webrisk/v1/SubmissionOrBuilder.java | 89 +- .../google/webrisk/v1/SubmitUriMetadata.java | 1338 ++++++ .../v1/SubmitUriMetadataOrBuilder.java | 120 + .../google/webrisk/v1/SubmitUriRequest.java | 1466 +++++++ .../webrisk/v1/SubmitUriRequestOrBuilder.java | 167 + .../google/webrisk/v1/ThreatDiscovery.java | 1084 +++++ .../webrisk/v1/ThreatDiscoveryOrBuilder.java | 105 + .../com/google/webrisk/v1/ThreatInfo.java | 3901 +++++++++++++++++ .../webrisk/v1/ThreatInfoOrBuilder.java | 120 + .../com/google/webrisk/v1/WebRiskProto.java | 303 +- .../google/cloud/webrisk/v1/webrisk.proto | 220 +- .../submituri/AsyncSubmitUri.java | 55 + .../submituri/AsyncSubmitUriLRO.java | 56 + .../submituri/SyncSubmitUri.java | 51 + 35 files changed, 10321 insertions(+), 209 deletions(-) create mode 100644 java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SubmitUriMetadata.java create mode 100644 java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SubmitUriMetadataOrBuilder.java create mode 100644 java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SubmitUriRequest.java create mode 100644 java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SubmitUriRequestOrBuilder.java create mode 100644 java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatDiscovery.java create mode 100644 java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatDiscoveryOrBuilder.java create mode 100644 java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatInfo.java create mode 100644 java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatInfoOrBuilder.java create mode 100644 java-webrisk/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskservice/submituri/AsyncSubmitUri.java create mode 100644 java-webrisk/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskservice/submituri/AsyncSubmitUriLRO.java create mode 100644 java-webrisk/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskservice/submituri/SyncSubmitUri.java diff --git a/java-webrisk/README.md b/java-webrisk/README.md index 7d04445af029..2df20831898f 100644 --- a/java-webrisk/README.md +++ b/java-webrisk/README.md @@ -20,7 +20,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file: com.google.cloud libraries-bom - 26.11.0 + 26.15.0 pom import @@ -195,7 +195,7 @@ Java is a registered trademark of Oracle and/or its affiliates. [kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.html [stability-image]: https://img.shields.io/badge/stability-stable-green [maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-webrisk.svg -[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-webrisk/2.13.0 +[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-webrisk/2.16.0 [authentication]: https://github.com/googleapis/google-cloud-java#authentication [auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes [predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles diff --git a/java-webrisk/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/WebRiskServiceClient.java b/java-webrisk/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/WebRiskServiceClient.java index cef1b385c241..8efac3c6879b 100644 --- a/java-webrisk/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/WebRiskServiceClient.java +++ b/java-webrisk/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/WebRiskServiceClient.java @@ -16,10 +16,15 @@ package com.google.cloud.webrisk.v1; +import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.httpjson.longrunning.OperationsClient; +import com.google.api.gax.longrunning.OperationFuture; +import com.google.api.gax.rpc.OperationCallable; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.webrisk.v1.stub.WebRiskServiceStub; import com.google.cloud.webrisk.v1.stub.WebRiskServiceStubSettings; +import com.google.longrunning.Operation; import com.google.protobuf.ByteString; import com.google.webrisk.v1.ComputeThreatListDiffRequest; import com.google.webrisk.v1.ComputeThreatListDiffResponse; @@ -30,6 +35,8 @@ import com.google.webrisk.v1.SearchUrisRequest; import com.google.webrisk.v1.SearchUrisResponse; import com.google.webrisk.v1.Submission; +import com.google.webrisk.v1.SubmitUriMetadata; +import com.google.webrisk.v1.SubmitUriRequest; import com.google.webrisk.v1.ThreatType; import java.io.IOException; import java.util.List; @@ -134,6 +141,8 @@ public class WebRiskServiceClient implements BackgroundResource { private final WebRiskServiceSettings settings; private final WebRiskServiceStub stub; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; /** Constructs an instance of WebRiskServiceClient with default settings. */ public static final WebRiskServiceClient create() throws IOException { @@ -165,11 +174,17 @@ public static final WebRiskServiceClient create(WebRiskServiceStub stub) { protected WebRiskServiceClient(WebRiskServiceSettings settings) throws IOException { this.settings = settings; this.stub = ((WebRiskServiceStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } protected WebRiskServiceClient(WebRiskServiceStub stub) { this.settings = null; this.stub = stub; + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } public final WebRiskServiceSettings getSettings() { @@ -180,6 +195,23 @@ public WebRiskServiceStub getStub() { return stub; } + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + public final com.google.longrunning.OperationsClient getOperationsClient() { + return operationsClient; + } + + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + @BetaApi + public final OperationsClient getHttpJsonOperationsClient() { + return httpJsonOperationsClient; + } + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the most recent threat list diffs. These diffs should be applied to a local database of @@ -640,6 +672,121 @@ public final UnaryCallable createSubmission return stub.createSubmissionCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Submits a URI suspected of containing malicious content to be reviewed. Returns a + * google.longrunning.Operation which, once the review is complete, is updated with its result. + * You can use the [Pub/Sub API] (https://cloud.google.com/pubsub) to receive notifications for + * the returned Operation. If the result verifies the existence of malicious content, the site + * will be added to the [Google's Social Engineering lists] + * (https://support.google.com/webmasters/answer/6350487/) in order to protect users that could + * get exposed to this threat in the future. Only allowlisted projects can use this method during + * Early Access. Please reach out to Sales or your customer engineer to obtain access. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
+   *   SubmitUriRequest request =
+   *       SubmitUriRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setSubmission(Submission.newBuilder().build())
+   *           .setThreatInfo(ThreatInfo.newBuilder().build())
+   *           .setThreatDiscovery(ThreatDiscovery.newBuilder().build())
+   *           .build();
+   *   Submission response = webRiskServiceClient.submitUriAsync(request).get();
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture submitUriAsync( + SubmitUriRequest request) { + return submitUriOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Submits a URI suspected of containing malicious content to be reviewed. Returns a + * google.longrunning.Operation which, once the review is complete, is updated with its result. + * You can use the [Pub/Sub API] (https://cloud.google.com/pubsub) to receive notifications for + * the returned Operation. If the result verifies the existence of malicious content, the site + * will be added to the [Google's Social Engineering lists] + * (https://support.google.com/webmasters/answer/6350487/) in order to protect users that could + * get exposed to this threat in the future. Only allowlisted projects can use this method during + * Early Access. Please reach out to Sales or your customer engineer to obtain access. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
+   *   SubmitUriRequest request =
+   *       SubmitUriRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setSubmission(Submission.newBuilder().build())
+   *           .setThreatInfo(ThreatInfo.newBuilder().build())
+   *           .setThreatDiscovery(ThreatDiscovery.newBuilder().build())
+   *           .build();
+   *   OperationFuture future =
+   *       webRiskServiceClient.submitUriOperationCallable().futureCall(request);
+   *   // Do something.
+   *   Submission response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable + submitUriOperationCallable() { + return stub.submitUriOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Submits a URI suspected of containing malicious content to be reviewed. Returns a + * google.longrunning.Operation which, once the review is complete, is updated with its result. + * You can use the [Pub/Sub API] (https://cloud.google.com/pubsub) to receive notifications for + * the returned Operation. If the result verifies the existence of malicious content, the site + * will be added to the [Google's Social Engineering lists] + * (https://support.google.com/webmasters/answer/6350487/) in order to protect users that could + * get exposed to this threat in the future. Only allowlisted projects can use this method during + * Early Access. Please reach out to Sales or your customer engineer to obtain access. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
+   *   SubmitUriRequest request =
+   *       SubmitUriRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setSubmission(Submission.newBuilder().build())
+   *           .setThreatInfo(ThreatInfo.newBuilder().build())
+   *           .setThreatDiscovery(ThreatDiscovery.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = webRiskServiceClient.submitUriCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable submitUriCallable() { + return stub.submitUriCallable(); + } + @Override public final void close() { stub.close(); diff --git a/java-webrisk/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/WebRiskServiceSettings.java b/java-webrisk/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/WebRiskServiceSettings.java index afc219225776..47caaa15528e 100644 --- a/java-webrisk/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/WebRiskServiceSettings.java +++ b/java-webrisk/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/WebRiskServiceSettings.java @@ -25,9 +25,11 @@ import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.OperationCallSettings; import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.webrisk.v1.stub.WebRiskServiceStubSettings; +import com.google.longrunning.Operation; import com.google.webrisk.v1.ComputeThreatListDiffRequest; import com.google.webrisk.v1.ComputeThreatListDiffResponse; import com.google.webrisk.v1.CreateSubmissionRequest; @@ -36,6 +38,8 @@ import com.google.webrisk.v1.SearchUrisRequest; import com.google.webrisk.v1.SearchUrisResponse; import com.google.webrisk.v1.Submission; +import com.google.webrisk.v1.SubmitUriMetadata; +import com.google.webrisk.v1.SubmitUriRequest; import java.io.IOException; import java.util.List; import javax.annotation.Generated; @@ -101,6 +105,17 @@ public UnaryCallSettings createSubmissionSe return ((WebRiskServiceStubSettings) getStubSettings()).createSubmissionSettings(); } + /** Returns the object with the settings used for calls to submitUri. */ + public UnaryCallSettings submitUriSettings() { + return ((WebRiskServiceStubSettings) getStubSettings()).submitUriSettings(); + } + + /** Returns the object with the settings used for calls to submitUri. */ + public OperationCallSettings + submitUriOperationSettings() { + return ((WebRiskServiceStubSettings) getStubSettings()).submitUriOperationSettings(); + } + public static final WebRiskServiceSettings create(WebRiskServiceStubSettings stub) throws IOException { return new WebRiskServiceSettings.Builder(stub.toBuilder()).build(); @@ -239,6 +254,17 @@ public UnaryCallSettings.Builder searchUr return getStubSettingsBuilder().createSubmissionSettings(); } + /** Returns the builder for the settings used for calls to submitUri. */ + public UnaryCallSettings.Builder submitUriSettings() { + return getStubSettingsBuilder().submitUriSettings(); + } + + /** Returns the builder for the settings used for calls to submitUri. */ + public OperationCallSettings.Builder + submitUriOperationSettings() { + return getStubSettingsBuilder().submitUriOperationSettings(); + } + @Override public WebRiskServiceSettings build() throws IOException { return new WebRiskServiceSettings(this); diff --git a/java-webrisk/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/gapic_metadata.json b/java-webrisk/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/gapic_metadata.json index 1ca85b86e39f..54077a4d69aa 100644 --- a/java-webrisk/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/gapic_metadata.json +++ b/java-webrisk/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/gapic_metadata.json @@ -21,6 +21,9 @@ }, "SearchUris": { "methods": ["searchUris", "searchUris", "searchUrisCallable"] + }, + "SubmitUri": { + "methods": ["submitUriAsync", "submitUriOperationCallable", "submitUriCallable"] } } } diff --git a/java-webrisk/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/GrpcWebRiskServiceStub.java b/java-webrisk/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/GrpcWebRiskServiceStub.java index 5249c975eb03..bdc3d30a6fa9 100644 --- a/java-webrisk/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/GrpcWebRiskServiceStub.java +++ b/java-webrisk/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/GrpcWebRiskServiceStub.java @@ -21,8 +21,10 @@ import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcStubCallableFactory; import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallable; import com.google.api.gax.rpc.UnaryCallable; import com.google.common.collect.ImmutableMap; +import com.google.longrunning.Operation; import com.google.longrunning.stub.GrpcOperationsStub; import com.google.webrisk.v1.ComputeThreatListDiffRequest; import com.google.webrisk.v1.ComputeThreatListDiffResponse; @@ -32,6 +34,8 @@ import com.google.webrisk.v1.SearchUrisRequest; import com.google.webrisk.v1.SearchUrisResponse; import com.google.webrisk.v1.Submission; +import com.google.webrisk.v1.SubmitUriMetadata; +import com.google.webrisk.v1.SubmitUriRequest; import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; import java.io.IOException; @@ -86,11 +90,22 @@ public class GrpcWebRiskServiceStub extends WebRiskServiceStub { .setResponseMarshaller(ProtoUtils.marshaller(Submission.getDefaultInstance())) .build(); + private static final MethodDescriptor submitUriMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.webrisk.v1.WebRiskService/SubmitUri") + .setRequestMarshaller(ProtoUtils.marshaller(SubmitUriRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + private final UnaryCallable computeThreatListDiffCallable; private final UnaryCallable searchUrisCallable; private final UnaryCallable searchHashesCallable; private final UnaryCallable createSubmissionCallable; + private final UnaryCallable submitUriCallable; + private final OperationCallable + submitUriOperationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -160,6 +175,16 @@ protected GrpcWebRiskServiceStub( return params.build(); }) .build(); + GrpcCallSettings submitUriTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(submitUriMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + }) + .build(); this.computeThreatListDiffCallable = callableFactory.createUnaryCallable( @@ -175,6 +200,15 @@ protected GrpcWebRiskServiceStub( this.createSubmissionCallable = callableFactory.createUnaryCallable( createSubmissionTransportSettings, settings.createSubmissionSettings(), clientContext); + this.submitUriCallable = + callableFactory.createUnaryCallable( + submitUriTransportSettings, settings.submitUriSettings(), clientContext); + this.submitUriOperationCallable = + callableFactory.createOperationCallable( + submitUriTransportSettings, + settings.submitUriOperationSettings(), + clientContext, + operationsStub); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -205,6 +239,17 @@ public UnaryCallable createSubmissionCallab return createSubmissionCallable; } + @Override + public UnaryCallable submitUriCallable() { + return submitUriCallable; + } + + @Override + public OperationCallable + submitUriOperationCallable() { + return submitUriOperationCallable; + } + @Override public final void close() { try { diff --git a/java-webrisk/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/HttpJsonWebRiskServiceStub.java b/java-webrisk/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/HttpJsonWebRiskServiceStub.java index 07c39eb5711c..ece2b4b3e77c 100644 --- a/java-webrisk/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/HttpJsonWebRiskServiceStub.java +++ b/java-webrisk/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/HttpJsonWebRiskServiceStub.java @@ -16,18 +16,24 @@ package com.google.cloud.webrisk.v1.stub; +import com.google.api.HttpRule; import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.httpjson.ApiMethodDescriptor; import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshot; import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; import com.google.api.gax.httpjson.ProtoMessageResponseParser; import com.google.api.gax.httpjson.ProtoRestSerializer; +import com.google.api.gax.httpjson.longrunning.stub.HttpJsonOperationsStub; import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallable; import com.google.api.gax.rpc.UnaryCallable; +import com.google.common.collect.ImmutableMap; +import com.google.longrunning.Operation; import com.google.protobuf.TypeRegistry; import com.google.webrisk.v1.ComputeThreatListDiffRequest; import com.google.webrisk.v1.ComputeThreatListDiffResponse; @@ -37,6 +43,8 @@ import com.google.webrisk.v1.SearchUrisRequest; import com.google.webrisk.v1.SearchUrisResponse; import com.google.webrisk.v1.Submission; +import com.google.webrisk.v1.SubmitUriMetadata; +import com.google.webrisk.v1.SubmitUriRequest; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; @@ -54,7 +62,11 @@ @Generated("by gapic-generator-java") @BetaApi public class HttpJsonWebRiskServiceStub extends WebRiskServiceStub { - private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build(); + private static final TypeRegistry typeRegistry = + TypeRegistry.newBuilder() + .add(Submission.getDescriptor()) + .add(SubmitUriMetadata.getDescriptor()) + .build(); private static final ApiMethodDescriptor< ComputeThreatListDiffRequest, ComputeThreatListDiffResponse> @@ -206,13 +218,56 @@ public class HttpJsonWebRiskServiceStub extends WebRiskServiceStub { .build()) .build(); + private static final ApiMethodDescriptor submitUriMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.webrisk.v1.WebRiskService/SubmitUri") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*}/uris:submit", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearParent().build(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (SubmitUriRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + private final UnaryCallable computeThreatListDiffCallable; private final UnaryCallable searchUrisCallable; private final UnaryCallable searchHashesCallable; private final UnaryCallable createSubmissionCallable; + private final UnaryCallable submitUriCallable; + private final OperationCallable + submitUriOperationCallable; private final BackgroundResource backgroundResources; + private final HttpJsonOperationsStub httpJsonOperationsStub; private final HttpJsonStubCallableFactory callableFactory; public static final HttpJsonWebRiskServiceStub create(WebRiskServiceStubSettings settings) @@ -253,6 +308,27 @@ protected HttpJsonWebRiskServiceStub( HttpJsonStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; + this.httpJsonOperationsStub = + HttpJsonOperationsStub.create( + clientContext, + callableFactory, + typeRegistry, + ImmutableMap.builder() + .put( + "google.longrunning.Operations.CancelOperation", + HttpRule.newBuilder() + .setPost("/v1/{name=projects/*/operations/*}:cancel") + .build()) + .put( + "google.longrunning.Operations.DeleteOperation", + HttpRule.newBuilder().setDelete("/v1/{name=projects/*/operations/*}").build()) + .put( + "google.longrunning.Operations.GetOperation", + HttpRule.newBuilder().setGet("/v1/{name=projects/*/operations/*}").build()) + .put( + "google.longrunning.Operations.ListOperations", + HttpRule.newBuilder().setGet("/v1/{name=projects/*}/operations").build()) + .build()); HttpJsonCallSettings computeThreatListDiffTransportSettings = @@ -276,6 +352,11 @@ protected HttpJsonWebRiskServiceStub( .setMethodDescriptor(createSubmissionMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings submitUriTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(submitUriMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.computeThreatListDiffCallable = callableFactory.createUnaryCallable( @@ -291,6 +372,15 @@ protected HttpJsonWebRiskServiceStub( this.createSubmissionCallable = callableFactory.createUnaryCallable( createSubmissionTransportSettings, settings.createSubmissionSettings(), clientContext); + this.submitUriCallable = + callableFactory.createUnaryCallable( + submitUriTransportSettings, settings.submitUriSettings(), clientContext); + this.submitUriOperationCallable = + callableFactory.createOperationCallable( + submitUriTransportSettings, + settings.submitUriOperationSettings(), + clientContext, + httpJsonOperationsStub); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -303,9 +393,14 @@ public static List getMethodDescriptors() { methodDescriptors.add(searchUrisMethodDescriptor); methodDescriptors.add(searchHashesMethodDescriptor); methodDescriptors.add(createSubmissionMethodDescriptor); + methodDescriptors.add(submitUriMethodDescriptor); return methodDescriptors; } + public HttpJsonOperationsStub getHttpJsonOperationsStub() { + return httpJsonOperationsStub; + } + @Override public UnaryCallable computeThreatListDiffCallable() { @@ -327,6 +422,17 @@ public UnaryCallable createSubmissionCallab return createSubmissionCallable; } + @Override + public UnaryCallable submitUriCallable() { + return submitUriCallable; + } + + @Override + public OperationCallable + submitUriOperationCallable() { + return submitUriOperationCallable; + } + @Override public final void close() { try { diff --git a/java-webrisk/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/WebRiskServiceStub.java b/java-webrisk/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/WebRiskServiceStub.java index b08ef82d1391..9543d7550ce8 100644 --- a/java-webrisk/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/WebRiskServiceStub.java +++ b/java-webrisk/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/WebRiskServiceStub.java @@ -17,7 +17,10 @@ package com.google.cloud.webrisk.v1.stub; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.OperationCallable; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; import com.google.webrisk.v1.ComputeThreatListDiffRequest; import com.google.webrisk.v1.ComputeThreatListDiffResponse; import com.google.webrisk.v1.CreateSubmissionRequest; @@ -26,6 +29,8 @@ import com.google.webrisk.v1.SearchUrisRequest; import com.google.webrisk.v1.SearchUrisResponse; import com.google.webrisk.v1.Submission; +import com.google.webrisk.v1.SubmitUriMetadata; +import com.google.webrisk.v1.SubmitUriRequest; import javax.annotation.Generated; // AUTO-GENERATED DOCUMENTATION AND CLASS. @@ -37,6 +42,14 @@ @Generated("by gapic-generator-java") public abstract class WebRiskServiceStub implements BackgroundResource { + public OperationsStub getOperationsStub() { + return null; + } + + public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() { + return null; + } + public UnaryCallable computeThreatListDiffCallable() { throw new UnsupportedOperationException("Not implemented: computeThreatListDiffCallable()"); @@ -54,6 +67,15 @@ public UnaryCallable createSubmissionCallab throw new UnsupportedOperationException("Not implemented: createSubmissionCallable()"); } + public OperationCallable + submitUriOperationCallable() { + throw new UnsupportedOperationException("Not implemented: submitUriOperationCallable()"); + } + + public UnaryCallable submitUriCallable() { + throw new UnsupportedOperationException("Not implemented: submitUriCallable()"); + } + @Override public abstract void close(); } diff --git a/java-webrisk/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/WebRiskServiceStubSettings.java b/java-webrisk/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/WebRiskServiceStubSettings.java index 259363b4bb79..4e5a0534e257 100644 --- a/java-webrisk/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/WebRiskServiceStubSettings.java +++ b/java-webrisk/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/WebRiskServiceStubSettings.java @@ -24,12 +24,16 @@ import com.google.api.gax.grpc.GaxGrpcProperties; import com.google.api.gax.grpc.GrpcTransportChannel; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.grpc.ProtoOperationTransformers; import com.google.api.gax.httpjson.GaxHttpJsonProperties; import com.google.api.gax.httpjson.HttpJsonTransportChannel; import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.longrunning.OperationSnapshot; +import com.google.api.gax.longrunning.OperationTimedPollAlgorithm; import com.google.api.gax.retrying.RetrySettings; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.StubSettings; import com.google.api.gax.rpc.TransportChannelProvider; @@ -38,6 +42,7 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Lists; +import com.google.longrunning.Operation; import com.google.webrisk.v1.ComputeThreatListDiffRequest; import com.google.webrisk.v1.ComputeThreatListDiffResponse; import com.google.webrisk.v1.CreateSubmissionRequest; @@ -46,6 +51,8 @@ import com.google.webrisk.v1.SearchUrisRequest; import com.google.webrisk.v1.SearchUrisResponse; import com.google.webrisk.v1.Submission; +import com.google.webrisk.v1.SubmitUriMetadata; +import com.google.webrisk.v1.SubmitUriRequest; import java.io.IOException; import java.util.List; import javax.annotation.Generated; @@ -99,6 +106,9 @@ public class WebRiskServiceStubSettings extends StubSettings searchUrisSettings; private final UnaryCallSettings searchHashesSettings; private final UnaryCallSettings createSubmissionSettings; + private final UnaryCallSettings submitUriSettings; + private final OperationCallSettings + submitUriOperationSettings; /** Returns the object with the settings used for calls to computeThreatListDiff. */ public UnaryCallSettings @@ -121,6 +131,17 @@ public UnaryCallSettings createSubmissionSe return createSubmissionSettings; } + /** Returns the object with the settings used for calls to submitUri. */ + public UnaryCallSettings submitUriSettings() { + return submitUriSettings; + } + + /** Returns the object with the settings used for calls to submitUri. */ + public OperationCallSettings + submitUriOperationSettings() { + return submitUriOperationSettings; + } + public WebRiskServiceStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -231,6 +252,8 @@ protected WebRiskServiceStubSettings(Builder settingsBuilder) throws IOException searchUrisSettings = settingsBuilder.searchUrisSettings().build(); searchHashesSettings = settingsBuilder.searchHashesSettings().build(); createSubmissionSettings = settingsBuilder.createSubmissionSettings().build(); + submitUriSettings = settingsBuilder.submitUriSettings().build(); + submitUriOperationSettings = settingsBuilder.submitUriOperationSettings().build(); } /** Builder for WebRiskServiceStubSettings. */ @@ -245,6 +268,9 @@ public static class Builder extends StubSettings.Builder createSubmissionSettings; + private final UnaryCallSettings.Builder submitUriSettings; + private final OperationCallSettings.Builder + submitUriOperationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -258,6 +284,7 @@ public static class Builder extends StubSettings.BuildernewArrayList())); + definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -285,6 +312,8 @@ public static class Builder extends StubSettings.Builder>of( computeThreatListDiffSettings, searchUrisSettings, searchHashesSettings, - createSubmissionSettings); + createSubmissionSettings, + submitUriSettings); initDefaults(this); } @@ -316,13 +348,16 @@ protected Builder(WebRiskServiceStubSettings settings) { searchUrisSettings = settings.searchUrisSettings.toBuilder(); searchHashesSettings = settings.searchHashesSettings.toBuilder(); createSubmissionSettings = settings.createSubmissionSettings.toBuilder(); + submitUriSettings = settings.submitUriSettings.toBuilder(); + submitUriOperationSettings = settings.submitUriOperationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( computeThreatListDiffSettings, searchUrisSettings, searchHashesSettings, - createSubmissionSettings); + createSubmissionSettings, + submitUriSettings); } private static Builder createDefault() { @@ -372,6 +407,34 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + builder + .submitUriSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .submitUriOperationSettings() + .setInitialCallSettings( + UnaryCallSettings.newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(Submission.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(SubmitUriMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + return builder; } @@ -413,6 +476,19 @@ public UnaryCallSettings.Builder searchUr return createSubmissionSettings; } + /** Returns the builder for the settings used for calls to submitUri. */ + public UnaryCallSettings.Builder submitUriSettings() { + return submitUriSettings; + } + + /** Returns the builder for the settings used for calls to submitUri. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder + submitUriOperationSettings() { + return submitUriOperationSettings; + } + @Override public WebRiskServiceStubSettings build() throws IOException { return new WebRiskServiceStubSettings(this); diff --git a/java-webrisk/google-cloud-webrisk/src/test/java/com/google/cloud/webrisk/v1/MockWebRiskServiceImpl.java b/java-webrisk/google-cloud-webrisk/src/test/java/com/google/cloud/webrisk/v1/MockWebRiskServiceImpl.java index fff196bb5c40..95808d9c9845 100644 --- a/java-webrisk/google-cloud-webrisk/src/test/java/com/google/cloud/webrisk/v1/MockWebRiskServiceImpl.java +++ b/java-webrisk/google-cloud-webrisk/src/test/java/com/google/cloud/webrisk/v1/MockWebRiskServiceImpl.java @@ -17,6 +17,7 @@ package com.google.cloud.webrisk.v1; import com.google.api.core.BetaApi; +import com.google.longrunning.Operation; import com.google.protobuf.AbstractMessage; import com.google.webrisk.v1.ComputeThreatListDiffRequest; import com.google.webrisk.v1.ComputeThreatListDiffResponse; @@ -26,6 +27,7 @@ import com.google.webrisk.v1.SearchUrisRequest; import com.google.webrisk.v1.SearchUrisResponse; import com.google.webrisk.v1.Submission; +import com.google.webrisk.v1.SubmitUriRequest; import com.google.webrisk.v1.WebRiskServiceGrpc.WebRiskServiceImplBase; import io.grpc.stub.StreamObserver; import java.util.ArrayList; @@ -150,4 +152,24 @@ public void createSubmission( Exception.class.getName()))); } } + + @Override + public void submitUri(SubmitUriRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method SubmitUri, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } } diff --git a/java-webrisk/google-cloud-webrisk/src/test/java/com/google/cloud/webrisk/v1/WebRiskServiceClientHttpJsonTest.java b/java-webrisk/google-cloud-webrisk/src/test/java/com/google/cloud/webrisk/v1/WebRiskServiceClientHttpJsonTest.java index 507f3bcd7bed..60c0e066cdc9 100644 --- a/java-webrisk/google-cloud-webrisk/src/test/java/com/google/cloud/webrisk/v1/WebRiskServiceClientHttpJsonTest.java +++ b/java-webrisk/google-cloud-webrisk/src/test/java/com/google/cloud/webrisk/v1/WebRiskServiceClientHttpJsonTest.java @@ -26,6 +26,8 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.webrisk.v1.stub.HttpJsonWebRiskServiceStub; +import com.google.longrunning.Operation; +import com.google.protobuf.Any; import com.google.protobuf.ByteString; import com.google.protobuf.Timestamp; import com.google.webrisk.v1.ComputeThreatListDiffRequest; @@ -34,12 +36,16 @@ import com.google.webrisk.v1.SearchHashesResponse; import com.google.webrisk.v1.SearchUrisResponse; import com.google.webrisk.v1.Submission; +import com.google.webrisk.v1.SubmitUriRequest; +import com.google.webrisk.v1.ThreatDiscovery; import com.google.webrisk.v1.ThreatEntryAdditions; import com.google.webrisk.v1.ThreatEntryRemovals; +import com.google.webrisk.v1.ThreatInfo; import com.google.webrisk.v1.ThreatType; import java.io.IOException; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.ExecutionException; import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; @@ -233,7 +239,11 @@ public void searchHashesExceptionTest() throws Exception { @Test public void createSubmissionTest() throws Exception { - Submission expectedResponse = Submission.newBuilder().setUri("uri116076").build(); + Submission expectedResponse = + Submission.newBuilder() + .setUri("uri116076") + .addAllThreatTypes(new ArrayList()) + .build(); mockService.addResponse(expectedResponse); ProjectName parent = ProjectName.of("[PROJECT]"); @@ -276,7 +286,11 @@ public void createSubmissionExceptionTest() throws Exception { @Test public void createSubmissionTest2() throws Exception { - Submission expectedResponse = Submission.newBuilder().setUri("uri116076").build(); + Submission expectedResponse = + Submission.newBuilder() + .setUri("uri116076") + .addAllThreatTypes(new ArrayList()) + .build(); mockService.addResponse(expectedResponse); String parent = "projects/project-2353"; @@ -316,4 +330,66 @@ public void createSubmissionExceptionTest2() throws Exception { // Expected exception. } } + + @Test + public void submitUriTest() throws Exception { + Submission expectedResponse = + Submission.newBuilder() + .setUri("uri116076") + .addAllThreatTypes(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("submitUriTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + SubmitUriRequest request = + SubmitUriRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setSubmission(Submission.newBuilder().build()) + .setThreatInfo(ThreatInfo.newBuilder().build()) + .setThreatDiscovery(ThreatDiscovery.newBuilder().build()) + .build(); + + Submission actualResponse = client.submitUriAsync(request).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void submitUriExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SubmitUriRequest request = + SubmitUriRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setSubmission(Submission.newBuilder().build()) + .setThreatInfo(ThreatInfo.newBuilder().build()) + .setThreatDiscovery(ThreatDiscovery.newBuilder().build()) + .build(); + client.submitUriAsync(request).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } } diff --git a/java-webrisk/google-cloud-webrisk/src/test/java/com/google/cloud/webrisk/v1/WebRiskServiceClientTest.java b/java-webrisk/google-cloud-webrisk/src/test/java/com/google/cloud/webrisk/v1/WebRiskServiceClientTest.java index f3f7f1b1d9ec..739ef5e8b240 100644 --- a/java-webrisk/google-cloud-webrisk/src/test/java/com/google/cloud/webrisk/v1/WebRiskServiceClientTest.java +++ b/java-webrisk/google-cloud-webrisk/src/test/java/com/google/cloud/webrisk/v1/WebRiskServiceClientTest.java @@ -23,7 +23,10 @@ import com.google.api.gax.grpc.testing.MockServiceHelper; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.longrunning.Operation; import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; import com.google.protobuf.ByteString; import com.google.protobuf.Timestamp; import com.google.webrisk.v1.ComputeThreatListDiffRequest; @@ -35,8 +38,11 @@ import com.google.webrisk.v1.SearchUrisRequest; import com.google.webrisk.v1.SearchUrisResponse; import com.google.webrisk.v1.Submission; +import com.google.webrisk.v1.SubmitUriRequest; +import com.google.webrisk.v1.ThreatDiscovery; import com.google.webrisk.v1.ThreatEntryAdditions; import com.google.webrisk.v1.ThreatEntryRemovals; +import com.google.webrisk.v1.ThreatInfo; import com.google.webrisk.v1.ThreatType; import io.grpc.StatusRuntimeException; import java.io.IOException; @@ -44,6 +50,7 @@ import java.util.Arrays; import java.util.List; import java.util.UUID; +import java.util.concurrent.ExecutionException; import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; @@ -227,7 +234,11 @@ public void searchHashesExceptionTest() throws Exception { @Test public void createSubmissionTest() throws Exception { - Submission expectedResponse = Submission.newBuilder().setUri("uri116076").build(); + Submission expectedResponse = + Submission.newBuilder() + .setUri("uri116076") + .addAllThreatTypes(new ArrayList()) + .build(); mockWebRiskService.addResponse(expectedResponse); ProjectName parent = ProjectName.of("[PROJECT]"); @@ -265,7 +276,11 @@ public void createSubmissionExceptionTest() throws Exception { @Test public void createSubmissionTest2() throws Exception { - Submission expectedResponse = Submission.newBuilder().setUri("uri116076").build(); + Submission expectedResponse = + Submission.newBuilder() + .setUri("uri116076") + .addAllThreatTypes(new ArrayList()) + .build(); mockWebRiskService.addResponse(expectedResponse); String parent = "parent-995424086"; @@ -300,4 +315,66 @@ public void createSubmissionExceptionTest2() throws Exception { // Expected exception. } } + + @Test + public void submitUriTest() throws Exception { + Submission expectedResponse = + Submission.newBuilder() + .setUri("uri116076") + .addAllThreatTypes(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("submitUriTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockWebRiskService.addResponse(resultOperation); + + SubmitUriRequest request = + SubmitUriRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setSubmission(Submission.newBuilder().build()) + .setThreatInfo(ThreatInfo.newBuilder().build()) + .setThreatDiscovery(ThreatDiscovery.newBuilder().build()) + .build(); + + Submission actualResponse = client.submitUriAsync(request).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockWebRiskService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + SubmitUriRequest actualRequest = ((SubmitUriRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getParent(), actualRequest.getParent()); + Assert.assertEquals(request.getSubmission(), actualRequest.getSubmission()); + Assert.assertEquals(request.getThreatInfo(), actualRequest.getThreatInfo()); + Assert.assertEquals(request.getThreatDiscovery(), actualRequest.getThreatDiscovery()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void submitUriExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockWebRiskService.addException(exception); + + try { + SubmitUriRequest request = + SubmitUriRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setSubmission(Submission.newBuilder().build()) + .setThreatInfo(ThreatInfo.newBuilder().build()) + .setThreatDiscovery(ThreatDiscovery.newBuilder().build()) + .build(); + client.submitUriAsync(request).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } } diff --git a/java-webrisk/grpc-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/WebRiskServiceGrpc.java b/java-webrisk/grpc-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/WebRiskServiceGrpc.java index 9bb6f3ce90a6..25df676d0a2e 100644 --- a/java-webrisk/grpc-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/WebRiskServiceGrpc.java +++ b/java-webrisk/grpc-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/WebRiskServiceGrpc.java @@ -211,6 +211,46 @@ private WebRiskServiceGrpc() {} return getCreateSubmissionMethod; } + private static volatile io.grpc.MethodDescriptor< + com.google.webrisk.v1.SubmitUriRequest, com.google.longrunning.Operation> + getSubmitUriMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "SubmitUri", + requestType = com.google.webrisk.v1.SubmitUriRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.webrisk.v1.SubmitUriRequest, com.google.longrunning.Operation> + getSubmitUriMethod() { + io.grpc.MethodDescriptor< + com.google.webrisk.v1.SubmitUriRequest, com.google.longrunning.Operation> + getSubmitUriMethod; + if ((getSubmitUriMethod = WebRiskServiceGrpc.getSubmitUriMethod) == null) { + synchronized (WebRiskServiceGrpc.class) { + if ((getSubmitUriMethod = WebRiskServiceGrpc.getSubmitUriMethod) == null) { + WebRiskServiceGrpc.getSubmitUriMethod = + getSubmitUriMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "SubmitUri")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.webrisk.v1.SubmitUriRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor(new WebRiskServiceMethodDescriptorSupplier("SubmitUri")) + .build(); + } + } + } + return getSubmitUriMethod; + } + /** Creates a new async stub that supports all call types for the service */ public static WebRiskServiceStub newStub(io.grpc.Channel channel) { io.grpc.stub.AbstractStub.StubFactory factory = @@ -336,6 +376,28 @@ default void createSubmission( io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( getCreateSubmissionMethod(), responseObserver); } + + /** + * + * + *
+     * Submits a URI suspected of containing malicious content to be reviewed.
+     * Returns a google.longrunning.Operation which, once the review is complete,
+     * is updated with its result. You can use the [Pub/Sub API]
+     * (https://cloud.google.com/pubsub) to receive notifications for the returned
+     * Operation. If the result verifies the existence of malicious content, the
+     * site will be added to the [Google's Social Engineering lists]
+     * (https://support.google.com/webmasters/answer/6350487/) in order to
+     * protect users that could get exposed to this threat in the future. Only
+     * allowlisted projects can use this method during Early Access. Please reach
+     * out to Sales or your customer engineer to obtain access.
+     * 
+ */ + default void submitUri( + com.google.webrisk.v1.SubmitUriRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getSubmitUriMethod(), responseObserver); + } } /** @@ -455,6 +517,29 @@ public void createSubmission( request, responseObserver); } + + /** + * + * + *
+     * Submits a URI suspected of containing malicious content to be reviewed.
+     * Returns a google.longrunning.Operation which, once the review is complete,
+     * is updated with its result. You can use the [Pub/Sub API]
+     * (https://cloud.google.com/pubsub) to receive notifications for the returned
+     * Operation. If the result verifies the existence of malicious content, the
+     * site will be added to the [Google's Social Engineering lists]
+     * (https://support.google.com/webmasters/answer/6350487/) in order to
+     * protect users that could get exposed to this threat in the future. Only
+     * allowlisted projects can use this method during Early Access. Please reach
+     * out to Sales or your customer engineer to obtain access.
+     * 
+ */ + public void submitUri( + com.google.webrisk.v1.SubmitUriRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getSubmitUriMethod(), getCallOptions()), request, responseObserver); + } } /** @@ -547,6 +632,28 @@ public com.google.webrisk.v1.Submission createSubmission( return io.grpc.stub.ClientCalls.blockingUnaryCall( getChannel(), getCreateSubmissionMethod(), getCallOptions(), request); } + + /** + * + * + *
+     * Submits a URI suspected of containing malicious content to be reviewed.
+     * Returns a google.longrunning.Operation which, once the review is complete,
+     * is updated with its result. You can use the [Pub/Sub API]
+     * (https://cloud.google.com/pubsub) to receive notifications for the returned
+     * Operation. If the result verifies the existence of malicious content, the
+     * site will be added to the [Google's Social Engineering lists]
+     * (https://support.google.com/webmasters/answer/6350487/) in order to
+     * protect users that could get exposed to this threat in the future. Only
+     * allowlisted projects can use this method during Early Access. Please reach
+     * out to Sales or your customer engineer to obtain access.
+     * 
+ */ + public com.google.longrunning.Operation submitUri( + com.google.webrisk.v1.SubmitUriRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getSubmitUriMethod(), getCallOptions(), request); + } } /** @@ -642,12 +749,35 @@ protected WebRiskServiceFutureStub build( return io.grpc.stub.ClientCalls.futureUnaryCall( getChannel().newCall(getCreateSubmissionMethod(), getCallOptions()), request); } + + /** + * + * + *
+     * Submits a URI suspected of containing malicious content to be reviewed.
+     * Returns a google.longrunning.Operation which, once the review is complete,
+     * is updated with its result. You can use the [Pub/Sub API]
+     * (https://cloud.google.com/pubsub) to receive notifications for the returned
+     * Operation. If the result verifies the existence of malicious content, the
+     * site will be added to the [Google's Social Engineering lists]
+     * (https://support.google.com/webmasters/answer/6350487/) in order to
+     * protect users that could get exposed to this threat in the future. Only
+     * allowlisted projects can use this method during Early Access. Please reach
+     * out to Sales or your customer engineer to obtain access.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + submitUri(com.google.webrisk.v1.SubmitUriRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getSubmitUriMethod(), getCallOptions()), request); + } } private static final int METHODID_COMPUTE_THREAT_LIST_DIFF = 0; private static final int METHODID_SEARCH_URIS = 1; private static final int METHODID_SEARCH_HASHES = 2; private static final int METHODID_CREATE_SUBMISSION = 3; + private static final int METHODID_SUBMIT_URI = 4; private static final class MethodHandlers implements io.grpc.stub.ServerCalls.UnaryMethod, @@ -689,6 +819,11 @@ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserv (com.google.webrisk.v1.CreateSubmissionRequest) request, (io.grpc.stub.StreamObserver) responseObserver); break; + case METHODID_SUBMIT_URI: + serviceImpl.submitUri( + (com.google.webrisk.v1.SubmitUriRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; default: throw new AssertionError(); } @@ -732,6 +867,12 @@ public static final io.grpc.ServerServiceDefinition bindService(AsyncService ser new MethodHandlers< com.google.webrisk.v1.CreateSubmissionRequest, com.google.webrisk.v1.Submission>(service, METHODID_CREATE_SUBMISSION))) + .addMethod( + getSubmitUriMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.webrisk.v1.SubmitUriRequest, com.google.longrunning.Operation>( + service, METHODID_SUBMIT_URI))) .build(); } @@ -787,6 +928,7 @@ public static io.grpc.ServiceDescriptor getServiceDescriptor() { .addMethod(getSearchUrisMethod()) .addMethod(getSearchHashesMethod()) .addMethod(getCreateSubmissionMethod()) + .addMethod(getSubmitUriMethod()) .build(); } } diff --git a/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ComputeThreatListDiffRequest.java b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ComputeThreatListDiffRequest.java index 82195856861f..78236a6da0a1 100644 --- a/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ComputeThreatListDiffRequest.java +++ b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ComputeThreatListDiffRequest.java @@ -1208,9 +1208,9 @@ public com.google.protobuf.Parser getParserForType() { * * *
-   * Required. The threat list to update. Only a single ThreatType should be specified
-   * per request. If you want to handle multiple ThreatTypes, you must make one
-   * request per ThreatType.
+   * Required. The threat list to update. Only a single ThreatType should be
+   * specified per request. If you want to handle multiple ThreatTypes, you must
+   * make one request per ThreatType.
    * 
* * @@ -1227,9 +1227,9 @@ public int getThreatTypeValue() { * * *
-   * Required. The threat list to update. Only a single ThreatType should be specified
-   * per request. If you want to handle multiple ThreatTypes, you must make one
-   * request per ThreatType.
+   * Required. The threat list to update. Only a single ThreatType should be
+   * specified per request. If you want to handle multiple ThreatTypes, you must
+   * make one request per ThreatType.
    * 
* * @@ -1723,9 +1723,9 @@ public Builder mergeFrom( * * *
-     * Required. The threat list to update. Only a single ThreatType should be specified
-     * per request. If you want to handle multiple ThreatTypes, you must make one
-     * request per ThreatType.
+     * Required. The threat list to update. Only a single ThreatType should be
+     * specified per request. If you want to handle multiple ThreatTypes, you must
+     * make one request per ThreatType.
      * 
* * @@ -1742,9 +1742,9 @@ public int getThreatTypeValue() { * * *
-     * Required. The threat list to update. Only a single ThreatType should be specified
-     * per request. If you want to handle multiple ThreatTypes, you must make one
-     * request per ThreatType.
+     * Required. The threat list to update. Only a single ThreatType should be
+     * specified per request. If you want to handle multiple ThreatTypes, you must
+     * make one request per ThreatType.
      * 
* * @@ -1764,9 +1764,9 @@ public Builder setThreatTypeValue(int value) { * * *
-     * Required. The threat list to update. Only a single ThreatType should be specified
-     * per request. If you want to handle multiple ThreatTypes, you must make one
-     * request per ThreatType.
+     * Required. The threat list to update. Only a single ThreatType should be
+     * specified per request. If you want to handle multiple ThreatTypes, you must
+     * make one request per ThreatType.
      * 
* * @@ -1785,9 +1785,9 @@ public com.google.webrisk.v1.ThreatType getThreatType() { * * *
-     * Required. The threat list to update. Only a single ThreatType should be specified
-     * per request. If you want to handle multiple ThreatTypes, you must make one
-     * request per ThreatType.
+     * Required. The threat list to update. Only a single ThreatType should be
+     * specified per request. If you want to handle multiple ThreatTypes, you must
+     * make one request per ThreatType.
      * 
* * @@ -1810,9 +1810,9 @@ public Builder setThreatType(com.google.webrisk.v1.ThreatType value) { * * *
-     * Required. The threat list to update. Only a single ThreatType should be specified
-     * per request. If you want to handle multiple ThreatTypes, you must make one
-     * request per ThreatType.
+     * Required. The threat list to update. Only a single ThreatType should be
+     * specified per request. If you want to handle multiple ThreatTypes, you must
+     * make one request per ThreatType.
      * 
* * diff --git a/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ComputeThreatListDiffRequestOrBuilder.java b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ComputeThreatListDiffRequestOrBuilder.java index f474f7868d4f..706564466b58 100644 --- a/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ComputeThreatListDiffRequestOrBuilder.java +++ b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ComputeThreatListDiffRequestOrBuilder.java @@ -27,9 +27,9 @@ public interface ComputeThreatListDiffRequestOrBuilder * * *
-   * Required. The threat list to update. Only a single ThreatType should be specified
-   * per request. If you want to handle multiple ThreatTypes, you must make one
-   * request per ThreatType.
+   * Required. The threat list to update. Only a single ThreatType should be
+   * specified per request. If you want to handle multiple ThreatTypes, you must
+   * make one request per ThreatType.
    * 
* * @@ -43,9 +43,9 @@ public interface ComputeThreatListDiffRequestOrBuilder * * *
-   * Required. The threat list to update. Only a single ThreatType should be specified
-   * per request. If you want to handle multiple ThreatTypes, you must make one
-   * request per ThreatType.
+   * Required. The threat list to update. Only a single ThreatType should be
+   * specified per request. If you want to handle multiple ThreatTypes, you must
+   * make one request per ThreatType.
    * 
* * diff --git a/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/CreateSubmissionRequest.java b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/CreateSubmissionRequest.java index 0db3e6eb0a89..66729b4b2108 100644 --- a/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/CreateSubmissionRequest.java +++ b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/CreateSubmissionRequest.java @@ -75,8 +75,8 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { * * *
-   * Required. The name of the project that is making the submission. This string is in
-   * the format "projects/{project_number}".
+   * Required. The name of the project that is making the submission. This
+   * string is in the format "projects/{project_number}".
    * 
* * @@ -101,8 +101,8 @@ public java.lang.String getParent() { * * *
-   * Required. The name of the project that is making the submission. This string is in
-   * the format "projects/{project_number}".
+   * Required. The name of the project that is making the submission. This
+   * string is in the format "projects/{project_number}".
    * 
* * @@ -557,8 +557,8 @@ public Builder mergeFrom( * * *
-     * Required. The name of the project that is making the submission. This string is in
-     * the format "projects/{project_number}".
+     * Required. The name of the project that is making the submission. This
+     * string is in the format "projects/{project_number}".
      * 
* * @@ -582,8 +582,8 @@ public java.lang.String getParent() { * * *
-     * Required. The name of the project that is making the submission. This string is in
-     * the format "projects/{project_number}".
+     * Required. The name of the project that is making the submission. This
+     * string is in the format "projects/{project_number}".
      * 
* * @@ -607,8 +607,8 @@ public com.google.protobuf.ByteString getParentBytes() { * * *
-     * Required. The name of the project that is making the submission. This string is in
-     * the format "projects/{project_number}".
+     * Required. The name of the project that is making the submission. This
+     * string is in the format "projects/{project_number}".
      * 
* * @@ -631,8 +631,8 @@ public Builder setParent(java.lang.String value) { * * *
-     * Required. The name of the project that is making the submission. This string is in
-     * the format "projects/{project_number}".
+     * Required. The name of the project that is making the submission. This
+     * string is in the format "projects/{project_number}".
      * 
* * @@ -651,8 +651,8 @@ public Builder clearParent() { * * *
-     * Required. The name of the project that is making the submission. This string is in
-     * the format "projects/{project_number}".
+     * Required. The name of the project that is making the submission. This
+     * string is in the format "projects/{project_number}".
      * 
* * diff --git a/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/CreateSubmissionRequestOrBuilder.java b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/CreateSubmissionRequestOrBuilder.java index 217fe1ef0a6e..c0d22247cad9 100644 --- a/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/CreateSubmissionRequestOrBuilder.java +++ b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/CreateSubmissionRequestOrBuilder.java @@ -27,8 +27,8 @@ public interface CreateSubmissionRequestOrBuilder * * *
-   * Required. The name of the project that is making the submission. This string is in
-   * the format "projects/{project_number}".
+   * Required. The name of the project that is making the submission. This
+   * string is in the format "projects/{project_number}".
    * 
* * @@ -42,8 +42,8 @@ public interface CreateSubmissionRequestOrBuilder * * *
-   * Required. The name of the project that is making the submission. This string is in
-   * the format "projects/{project_number}".
+   * Required. The name of the project that is making the submission. This
+   * string is in the format "projects/{project_number}".
    * 
* * diff --git a/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchHashesRequest.java b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchHashesRequest.java index 85d19d21732b..5d3152c007ec 100644 --- a/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchHashesRequest.java +++ b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchHashesRequest.java @@ -109,7 +109,8 @@ public com.google.webrisk.v1.ThreatType convert(java.lang.Integer from) { * * *
-   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be
+   * specified.
    * 
* * @@ -127,7 +128,8 @@ public java.util.List getThreatTypesList() { * * *
-   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be
+   * specified.
    * 
* * @@ -144,7 +146,8 @@ public int getThreatTypesCount() { * * *
-   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be
+   * specified.
    * 
* * @@ -162,7 +165,8 @@ public com.google.webrisk.v1.ThreatType getThreatTypes(int index) { * * *
-   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be
+   * specified.
    * 
* * @@ -179,7 +183,8 @@ public java.util.List getThreatTypesValueList() { * * *
-   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be
+   * specified.
    * 
* * @@ -676,7 +681,8 @@ private void ensureThreatTypesIsMutable() { * * *
-     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be
+     * specified.
      * 
* * @@ -694,7 +700,8 @@ public java.util.List getThreatTypesList() { * * *
-     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be
+     * specified.
      * 
* * @@ -710,7 +717,8 @@ public int getThreatTypesCount() { * * *
-     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be
+     * specified.
      * 
* * @@ -727,7 +735,8 @@ public com.google.webrisk.v1.ThreatType getThreatTypes(int index) { * * *
-     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be
+     * specified.
      * 
* * @@ -751,7 +760,8 @@ public Builder setThreatTypes(int index, com.google.webrisk.v1.ThreatType value) * * *
-     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be
+     * specified.
      * 
* * @@ -774,7 +784,8 @@ public Builder addThreatTypes(com.google.webrisk.v1.ThreatType value) { * * *
-     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be
+     * specified.
      * 
* * @@ -797,7 +808,8 @@ public Builder addAllThreatTypes( * * *
-     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be
+     * specified.
      * 
* * @@ -816,7 +828,8 @@ public Builder clearThreatTypes() { * * *
-     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be
+     * specified.
      * 
* * @@ -832,7 +845,8 @@ public java.util.List getThreatTypesValueList() { * * *
-     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be
+     * specified.
      * 
* * @@ -849,7 +863,8 @@ public int getThreatTypesValue(int index) { * * *
-     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be
+     * specified.
      * 
* * @@ -870,7 +885,8 @@ public Builder setThreatTypesValue(int index, int value) { * * *
-     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be
+     * specified.
      * 
* * @@ -890,7 +906,8 @@ public Builder addThreatTypesValue(int value) { * * *
-     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be
+     * specified.
      * 
* * diff --git a/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchHashesRequestOrBuilder.java b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchHashesRequestOrBuilder.java index 120f71e5fe92..af818430c1c5 100644 --- a/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchHashesRequestOrBuilder.java +++ b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchHashesRequestOrBuilder.java @@ -43,7 +43,8 @@ public interface SearchHashesRequestOrBuilder * * *
-   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be
+   * specified.
    * 
* * @@ -57,7 +58,8 @@ public interface SearchHashesRequestOrBuilder * * *
-   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be
+   * specified.
    * 
* * @@ -71,7 +73,8 @@ public interface SearchHashesRequestOrBuilder * * *
-   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be
+   * specified.
    * 
* * @@ -86,7 +89,8 @@ public interface SearchHashesRequestOrBuilder * * *
-   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be
+   * specified.
    * 
* * @@ -100,7 +104,8 @@ public interface SearchHashesRequestOrBuilder * * *
-   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be
+   * specified.
    * 
* * diff --git a/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchUrisRequest.java b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchUrisRequest.java index 2c25e48fa4e9..675941c71d3c 100644 --- a/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchUrisRequest.java +++ b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchUrisRequest.java @@ -139,7 +139,8 @@ public com.google.webrisk.v1.ThreatType convert(java.lang.Integer from) { * * *
-   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be
+   * specified.
    * 
* * @@ -157,7 +158,8 @@ public java.util.List getThreatTypesList() { * * *
-   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be
+   * specified.
    * 
* * @@ -174,7 +176,8 @@ public int getThreatTypesCount() { * * *
-   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be
+   * specified.
    * 
* * @@ -192,7 +195,8 @@ public com.google.webrisk.v1.ThreatType getThreatTypes(int index) { * * *
-   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be
+   * specified.
    * 
* * @@ -209,7 +213,8 @@ public java.util.List getThreatTypesValueList() { * * *
-   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be
+   * specified.
    * 
* * @@ -749,7 +754,8 @@ private void ensureThreatTypesIsMutable() { * * *
-     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be
+     * specified.
      * 
* * @@ -767,7 +773,8 @@ public java.util.List getThreatTypesList() { * * *
-     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be
+     * specified.
      * 
* * @@ -783,7 +790,8 @@ public int getThreatTypesCount() { * * *
-     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be
+     * specified.
      * 
* * @@ -800,7 +808,8 @@ public com.google.webrisk.v1.ThreatType getThreatTypes(int index) { * * *
-     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be
+     * specified.
      * 
* * @@ -824,7 +833,8 @@ public Builder setThreatTypes(int index, com.google.webrisk.v1.ThreatType value) * * *
-     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be
+     * specified.
      * 
* * @@ -847,7 +857,8 @@ public Builder addThreatTypes(com.google.webrisk.v1.ThreatType value) { * * *
-     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be
+     * specified.
      * 
* * @@ -870,7 +881,8 @@ public Builder addAllThreatTypes( * * *
-     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be
+     * specified.
      * 
* * @@ -889,7 +901,8 @@ public Builder clearThreatTypes() { * * *
-     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be
+     * specified.
      * 
* * @@ -905,7 +918,8 @@ public java.util.List getThreatTypesValueList() { * * *
-     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be
+     * specified.
      * 
* * @@ -922,7 +936,8 @@ public int getThreatTypesValue(int index) { * * *
-     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be
+     * specified.
      * 
* * @@ -943,7 +958,8 @@ public Builder setThreatTypesValue(int index, int value) { * * *
-     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be
+     * specified.
      * 
* * @@ -963,7 +979,8 @@ public Builder addThreatTypesValue(int value) { * * *
-     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be
+     * specified.
      * 
* * diff --git a/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchUrisRequestOrBuilder.java b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchUrisRequestOrBuilder.java index a49b7bfa4954..ffead512b6d9 100644 --- a/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchUrisRequestOrBuilder.java +++ b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchUrisRequestOrBuilder.java @@ -52,7 +52,8 @@ public interface SearchUrisRequestOrBuilder * * *
-   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be
+   * specified.
    * 
* * @@ -66,7 +67,8 @@ public interface SearchUrisRequestOrBuilder * * *
-   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be
+   * specified.
    * 
* * @@ -80,7 +82,8 @@ public interface SearchUrisRequestOrBuilder * * *
-   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be
+   * specified.
    * 
* * @@ -95,7 +98,8 @@ public interface SearchUrisRequestOrBuilder * * *
-   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be
+   * specified.
    * 
* * @@ -109,7 +113,8 @@ public interface SearchUrisRequestOrBuilder * * *
-   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be
+   * specified.
    * 
* * diff --git a/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/Submission.java b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/Submission.java index 0b4ece132850..35ac33fbffa3 100644 --- a/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/Submission.java +++ b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/Submission.java @@ -39,6 +39,7 @@ private Submission(com.google.protobuf.GeneratedMessageV3.Builder builder) { private Submission() { uri_ = ""; + threatTypes_ = java.util.Collections.emptyList(); } @java.lang.Override @@ -74,7 +75,8 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { * * *
-   * Required. The URI that is being reported for malicious content to be analyzed.
+   * Required. The URI that is being reported for malicious content to be
+   * analyzed.
    * 
* * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -97,7 +99,8 @@ public java.lang.String getUri() { * * *
-   * Required. The URI that is being reported for malicious content to be analyzed.
+   * Required. The URI that is being reported for malicious content to be
+   * analyzed.
    * 
* * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -117,6 +120,123 @@ public com.google.protobuf.ByteString getUriBytes() { } } + public static final int THREAT_TYPES_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private java.util.List threatTypes_; + + private static final com.google.protobuf.Internal.ListAdapter.Converter< + java.lang.Integer, com.google.webrisk.v1.ThreatType> + threatTypes_converter_ = + new com.google.protobuf.Internal.ListAdapter.Converter< + java.lang.Integer, com.google.webrisk.v1.ThreatType>() { + public com.google.webrisk.v1.ThreatType convert(java.lang.Integer from) { + com.google.webrisk.v1.ThreatType result = + com.google.webrisk.v1.ThreatType.forNumber(from); + return result == null ? com.google.webrisk.v1.ThreatType.UNRECOGNIZED : result; + } + }; + /** + * + * + *
+   * Output only. ThreatTypes found to be associated with the submitted URI
+   * after reviewing it. This might be empty if the URI was not added to any
+   * list.
+   * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return A list containing the threatTypes. + */ + @java.lang.Override + public java.util.List getThreatTypesList() { + return new com.google.protobuf.Internal.ListAdapter< + java.lang.Integer, com.google.webrisk.v1.ThreatType>(threatTypes_, threatTypes_converter_); + } + /** + * + * + *
+   * Output only. ThreatTypes found to be associated with the submitted URI
+   * after reviewing it. This might be empty if the URI was not added to any
+   * list.
+   * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The count of threatTypes. + */ + @java.lang.Override + public int getThreatTypesCount() { + return threatTypes_.size(); + } + /** + * + * + *
+   * Output only. ThreatTypes found to be associated with the submitted URI
+   * after reviewing it. This might be empty if the URI was not added to any
+   * list.
+   * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param index The index of the element to return. + * @return The threatTypes at the given index. + */ + @java.lang.Override + public com.google.webrisk.v1.ThreatType getThreatTypes(int index) { + return threatTypes_converter_.convert(threatTypes_.get(index)); + } + /** + * + * + *
+   * Output only. ThreatTypes found to be associated with the submitted URI
+   * after reviewing it. This might be empty if the URI was not added to any
+   * list.
+   * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return A list containing the enum numeric values on the wire for threatTypes. + */ + @java.lang.Override + public java.util.List getThreatTypesValueList() { + return threatTypes_; + } + /** + * + * + *
+   * Output only. ThreatTypes found to be associated with the submitted URI
+   * after reviewing it. This might be empty if the URI was not added to any
+   * list.
+   * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of threatTypes at the given index. + */ + @java.lang.Override + public int getThreatTypesValue(int index) { + return threatTypes_.get(index); + } + + private int threatTypesMemoizedSerializedSize; + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -131,9 +251,17 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + getSerializedSize(); if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uri_)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, uri_); } + if (getThreatTypesList().size() > 0) { + output.writeUInt32NoTag(18); + output.writeUInt32NoTag(threatTypesMemoizedSerializedSize); + } + for (int i = 0; i < threatTypes_.size(); i++) { + output.writeEnumNoTag(threatTypes_.get(i)); + } getUnknownFields().writeTo(output); } @@ -146,6 +274,18 @@ public int getSerializedSize() { if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uri_)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, uri_); } + { + int dataSize = 0; + for (int i = 0; i < threatTypes_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream.computeEnumSizeNoTag(threatTypes_.get(i)); + } + size += dataSize; + if (!getThreatTypesList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(dataSize); + } + threatTypesMemoizedSerializedSize = dataSize; + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -162,6 +302,7 @@ public boolean equals(final java.lang.Object obj) { com.google.webrisk.v1.Submission other = (com.google.webrisk.v1.Submission) obj; if (!getUri().equals(other.getUri())) return false; + if (!threatTypes_.equals(other.threatTypes_)) return false; if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -175,6 +316,10 @@ public int hashCode() { hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + URI_FIELD_NUMBER; hash = (53 * hash) + getUri().hashCode(); + if (getThreatTypesCount() > 0) { + hash = (37 * hash) + THREAT_TYPES_FIELD_NUMBER; + hash = (53 * hash) + threatTypes_.hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -314,6 +459,8 @@ public Builder clear() { super.clear(); bitField0_ = 0; uri_ = ""; + threatTypes_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); return this; } @@ -340,6 +487,7 @@ public com.google.webrisk.v1.Submission build() { @java.lang.Override public com.google.webrisk.v1.Submission buildPartial() { com.google.webrisk.v1.Submission result = new com.google.webrisk.v1.Submission(this); + buildPartialRepeatedFields(result); if (bitField0_ != 0) { buildPartial0(result); } @@ -347,6 +495,14 @@ public com.google.webrisk.v1.Submission buildPartial() { return result; } + private void buildPartialRepeatedFields(com.google.webrisk.v1.Submission result) { + if (((bitField0_ & 0x00000002) != 0)) { + threatTypes_ = java.util.Collections.unmodifiableList(threatTypes_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.threatTypes_ = threatTypes_; + } + private void buildPartial0(com.google.webrisk.v1.Submission result) { int from_bitField0_ = bitField0_; if (((from_bitField0_ & 0x00000001) != 0)) { @@ -404,6 +560,16 @@ public Builder mergeFrom(com.google.webrisk.v1.Submission other) { bitField0_ |= 0x00000001; onChanged(); } + if (!other.threatTypes_.isEmpty()) { + if (threatTypes_.isEmpty()) { + threatTypes_ = other.threatTypes_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureThreatTypesIsMutable(); + threatTypes_.addAll(other.threatTypes_); + } + onChanged(); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -436,6 +602,25 @@ public Builder mergeFrom( bitField0_ |= 0x00000001; break; } // case 10 + case 16: + { + int tmpRaw = input.readEnum(); + ensureThreatTypesIsMutable(); + threatTypes_.add(tmpRaw); + break; + } // case 16 + case 18: + { + int length = input.readRawVarint32(); + int oldLimit = input.pushLimit(length); + while (input.getBytesUntilLimit() > 0) { + int tmpRaw = input.readEnum(); + ensureThreatTypesIsMutable(); + threatTypes_.add(tmpRaw); + } + input.popLimit(oldLimit); + break; + } // case 18 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -460,7 +645,8 @@ public Builder mergeFrom( * * *
-     * Required. The URI that is being reported for malicious content to be analyzed.
+     * Required. The URI that is being reported for malicious content to be
+     * analyzed.
      * 
* * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -482,7 +668,8 @@ public java.lang.String getUri() { * * *
-     * Required. The URI that is being reported for malicious content to be analyzed.
+     * Required. The URI that is being reported for malicious content to be
+     * analyzed.
      * 
* * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -504,7 +691,8 @@ public com.google.protobuf.ByteString getUriBytes() { * * *
-     * Required. The URI that is being reported for malicious content to be analyzed.
+     * Required. The URI that is being reported for malicious content to be
+     * analyzed.
      * 
* * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -525,7 +713,8 @@ public Builder setUri(java.lang.String value) { * * *
-     * Required. The URI that is being reported for malicious content to be analyzed.
+     * Required. The URI that is being reported for malicious content to be
+     * analyzed.
      * 
* * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -542,7 +731,8 @@ public Builder clearUri() { * * *
-     * Required. The URI that is being reported for malicious content to be analyzed.
+     * Required. The URI that is being reported for malicious content to be
+     * analyzed.
      * 
* * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -561,6 +751,275 @@ public Builder setUriBytes(com.google.protobuf.ByteString value) { return this; } + private java.util.List threatTypes_ = java.util.Collections.emptyList(); + + private void ensureThreatTypesIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + threatTypes_ = new java.util.ArrayList(threatTypes_); + bitField0_ |= 0x00000002; + } + } + /** + * + * + *
+     * Output only. ThreatTypes found to be associated with the submitted URI
+     * after reviewing it. This might be empty if the URI was not added to any
+     * list.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return A list containing the threatTypes. + */ + public java.util.List getThreatTypesList() { + return new com.google.protobuf.Internal.ListAdapter< + java.lang.Integer, com.google.webrisk.v1.ThreatType>( + threatTypes_, threatTypes_converter_); + } + /** + * + * + *
+     * Output only. ThreatTypes found to be associated with the submitted URI
+     * after reviewing it. This might be empty if the URI was not added to any
+     * list.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The count of threatTypes. + */ + public int getThreatTypesCount() { + return threatTypes_.size(); + } + /** + * + * + *
+     * Output only. ThreatTypes found to be associated with the submitted URI
+     * after reviewing it. This might be empty if the URI was not added to any
+     * list.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param index The index of the element to return. + * @return The threatTypes at the given index. + */ + public com.google.webrisk.v1.ThreatType getThreatTypes(int index) { + return threatTypes_converter_.convert(threatTypes_.get(index)); + } + /** + * + * + *
+     * Output only. ThreatTypes found to be associated with the submitted URI
+     * after reviewing it. This might be empty if the URI was not added to any
+     * list.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param index The index to set the value at. + * @param value The threatTypes to set. + * @return This builder for chaining. + */ + public Builder setThreatTypes(int index, com.google.webrisk.v1.ThreatType value) { + if (value == null) { + throw new NullPointerException(); + } + ensureThreatTypesIsMutable(); + threatTypes_.set(index, value.getNumber()); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. ThreatTypes found to be associated with the submitted URI
+     * after reviewing it. This might be empty if the URI was not added to any
+     * list.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The threatTypes to add. + * @return This builder for chaining. + */ + public Builder addThreatTypes(com.google.webrisk.v1.ThreatType value) { + if (value == null) { + throw new NullPointerException(); + } + ensureThreatTypesIsMutable(); + threatTypes_.add(value.getNumber()); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. ThreatTypes found to be associated with the submitted URI
+     * after reviewing it. This might be empty if the URI was not added to any
+     * list.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param values The threatTypes to add. + * @return This builder for chaining. + */ + public Builder addAllThreatTypes( + java.lang.Iterable values) { + ensureThreatTypesIsMutable(); + for (com.google.webrisk.v1.ThreatType value : values) { + threatTypes_.add(value.getNumber()); + } + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. ThreatTypes found to be associated with the submitted URI
+     * after reviewing it. This might be empty if the URI was not added to any
+     * list.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. + */ + public Builder clearThreatTypes() { + threatTypes_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. ThreatTypes found to be associated with the submitted URI
+     * after reviewing it. This might be empty if the URI was not added to any
+     * list.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return A list containing the enum numeric values on the wire for threatTypes. + */ + public java.util.List getThreatTypesValueList() { + return java.util.Collections.unmodifiableList(threatTypes_); + } + /** + * + * + *
+     * Output only. ThreatTypes found to be associated with the submitted URI
+     * after reviewing it. This might be empty if the URI was not added to any
+     * list.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of threatTypes at the given index. + */ + public int getThreatTypesValue(int index) { + return threatTypes_.get(index); + } + /** + * + * + *
+     * Output only. ThreatTypes found to be associated with the submitted URI
+     * after reviewing it. This might be empty if the URI was not added to any
+     * list.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param index The index to set the value at. + * @param value The enum numeric value on the wire for threatTypes to set. + * @return This builder for chaining. + */ + public Builder setThreatTypesValue(int index, int value) { + ensureThreatTypesIsMutable(); + threatTypes_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. ThreatTypes found to be associated with the submitted URI
+     * after reviewing it. This might be empty if the URI was not added to any
+     * list.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The enum numeric value on the wire for threatTypes to add. + * @return This builder for chaining. + */ + public Builder addThreatTypesValue(int value) { + ensureThreatTypesIsMutable(); + threatTypes_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. ThreatTypes found to be associated with the submitted URI
+     * after reviewing it. This might be empty if the URI was not added to any
+     * list.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param values The enum numeric values on the wire for threatTypes to add. + * @return This builder for chaining. + */ + public Builder addAllThreatTypesValue(java.lang.Iterable values) { + ensureThreatTypesIsMutable(); + for (int value : values) { + threatTypes_.add(value); + } + onChanged(); + return this; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SubmissionOrBuilder.java b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SubmissionOrBuilder.java index d9a5a0796bf4..06bfeafaf324 100644 --- a/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SubmissionOrBuilder.java +++ b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SubmissionOrBuilder.java @@ -27,7 +27,8 @@ public interface SubmissionOrBuilder * * *
-   * Required. The URI that is being reported for malicious content to be analyzed.
+   * Required. The URI that is being reported for malicious content to be
+   * analyzed.
    * 
* * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -39,7 +40,8 @@ public interface SubmissionOrBuilder * * *
-   * Required. The URI that is being reported for malicious content to be analyzed.
+   * Required. The URI that is being reported for malicious content to be
+   * analyzed.
    * 
* * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -47,4 +49,87 @@ public interface SubmissionOrBuilder * @return The bytes for uri. */ com.google.protobuf.ByteString getUriBytes(); + + /** + * + * + *
+   * Output only. ThreatTypes found to be associated with the submitted URI
+   * after reviewing it. This might be empty if the URI was not added to any
+   * list.
+   * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return A list containing the threatTypes. + */ + java.util.List getThreatTypesList(); + /** + * + * + *
+   * Output only. ThreatTypes found to be associated with the submitted URI
+   * after reviewing it. This might be empty if the URI was not added to any
+   * list.
+   * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The count of threatTypes. + */ + int getThreatTypesCount(); + /** + * + * + *
+   * Output only. ThreatTypes found to be associated with the submitted URI
+   * after reviewing it. This might be empty if the URI was not added to any
+   * list.
+   * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param index The index of the element to return. + * @return The threatTypes at the given index. + */ + com.google.webrisk.v1.ThreatType getThreatTypes(int index); + /** + * + * + *
+   * Output only. ThreatTypes found to be associated with the submitted URI
+   * after reviewing it. This might be empty if the URI was not added to any
+   * list.
+   * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return A list containing the enum numeric values on the wire for threatTypes. + */ + java.util.List getThreatTypesValueList(); + /** + * + * + *
+   * Output only. ThreatTypes found to be associated with the submitted URI
+   * after reviewing it. This might be empty if the URI was not added to any
+   * list.
+   * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of threatTypes at the given index. + */ + int getThreatTypesValue(int index); } diff --git a/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SubmitUriMetadata.java b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SubmitUriMetadata.java new file mode 100644 index 000000000000..5e0a76f69efb --- /dev/null +++ b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SubmitUriMetadata.java @@ -0,0 +1,1338 @@ +/* + * 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 + * + * 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/webrisk/v1/webrisk.proto + +package com.google.webrisk.v1; + +/** + * + * + *
+ * Metadata for the Submit URI long-running operation.
+ * option (google.api.message_visibility).restriction = "TRUSTED_TESTER";
+ * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.SubmitUriMetadata} + */ +public final class SubmitUriMetadata extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.webrisk.v1.SubmitUriMetadata) + SubmitUriMetadataOrBuilder { + private static final long serialVersionUID = 0L; + // Use SubmitUriMetadata.newBuilder() to construct. + private SubmitUriMetadata(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private SubmitUriMetadata() { + state_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new SubmitUriMetadata(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SubmitUriMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SubmitUriMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.SubmitUriMetadata.class, + com.google.webrisk.v1.SubmitUriMetadata.Builder.class); + } + + /** + * + * + *
+   * Enum that represents the state of the long-running operation.
+   * 
+ * + * Protobuf enum {@code google.cloud.webrisk.v1.SubmitUriMetadata.State} + */ + public enum State implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Default unspecified state.
+     * 
+ * + * STATE_UNSPECIFIED = 0; + */ + STATE_UNSPECIFIED(0), + /** + * + * + *
+     * The operation is currently running.
+     * 
+ * + * RUNNING = 1; + */ + RUNNING(1), + /** + * + * + *
+     * The operation finished with a success status.
+     * 
+ * + * SUCCEEDED = 2; + */ + SUCCEEDED(2), + /** + * + * + *
+     * The operation was cancelled.
+     * 
+ * + * CANCELLED = 3; + */ + CANCELLED(3), + /** + * + * + *
+     * The operation finished with a failure status.
+     * 
+ * + * FAILED = 4; + */ + FAILED(4), + /** + * + * + *
+     * The operation was closed with no action taken.
+     * 
+ * + * CLOSED = 5; + */ + CLOSED(5), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Default unspecified state.
+     * 
+ * + * STATE_UNSPECIFIED = 0; + */ + public static final int STATE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * The operation is currently running.
+     * 
+ * + * RUNNING = 1; + */ + public static final int RUNNING_VALUE = 1; + /** + * + * + *
+     * The operation finished with a success status.
+     * 
+ * + * SUCCEEDED = 2; + */ + public static final int SUCCEEDED_VALUE = 2; + /** + * + * + *
+     * The operation was cancelled.
+     * 
+ * + * CANCELLED = 3; + */ + public static final int CANCELLED_VALUE = 3; + /** + * + * + *
+     * The operation finished with a failure status.
+     * 
+ * + * FAILED = 4; + */ + public static final int FAILED_VALUE = 4; + /** + * + * + *
+     * The operation was closed with no action taken.
+     * 
+ * + * CLOSED = 5; + */ + public static final int CLOSED_VALUE = 5; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static State valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static State forNumber(int value) { + switch (value) { + case 0: + return STATE_UNSPECIFIED; + case 1: + return RUNNING; + case 2: + return SUCCEEDED; + case 3: + return CANCELLED; + case 4: + return FAILED; + case 5: + return CLOSED; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public State findValueByNumber(int number) { + return State.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.webrisk.v1.SubmitUriMetadata.getDescriptor().getEnumTypes().get(0); + } + + private static final State[] VALUES = values(); + + public static State valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private State(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.webrisk.v1.SubmitUriMetadata.State) + } + + public static final int STATE_FIELD_NUMBER = 1; + private int state_ = 0; + /** + * + * + *
+   * The state of the operation.
+   * 
+ * + * .google.cloud.webrisk.v1.SubmitUriMetadata.State state = 1; + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + /** + * + * + *
+   * The state of the operation.
+   * 
+ * + * .google.cloud.webrisk.v1.SubmitUriMetadata.State state = 1; + * + * @return The state. + */ + @java.lang.Override + public com.google.webrisk.v1.SubmitUriMetadata.State getState() { + com.google.webrisk.v1.SubmitUriMetadata.State result = + com.google.webrisk.v1.SubmitUriMetadata.State.forNumber(state_); + return result == null ? com.google.webrisk.v1.SubmitUriMetadata.State.UNRECOGNIZED : result; + } + + public static final int CREATE_TIME_FIELD_NUMBER = 2; + private com.google.protobuf.Timestamp createTime_; + /** + * + * + *
+   * Creation time of the operation.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 2; + * + * @return Whether the createTime field is set. + */ + @java.lang.Override + public boolean hasCreateTime() { + return createTime_ != null; + } + /** + * + * + *
+   * Creation time of the operation.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 2; + * + * @return The createTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getCreateTime() { + return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } + /** + * + * + *
+   * Creation time of the operation.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } + + public static final int UPDATE_TIME_FIELD_NUMBER = 3; + private com.google.protobuf.Timestamp updateTime_; + /** + * + * + *
+   * Latest update time of the operation.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 3; + * + * @return Whether the updateTime field is set. + */ + @java.lang.Override + public boolean hasUpdateTime() { + return updateTime_ != null; + } + /** + * + * + *
+   * Latest update time of the operation.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 3; + * + * @return The updateTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getUpdateTime() { + return updateTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : updateTime_; + } + /** + * + * + *
+   * Latest update time of the operation.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 3; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + return updateTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : updateTime_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (state_ != com.google.webrisk.v1.SubmitUriMetadata.State.STATE_UNSPECIFIED.getNumber()) { + output.writeEnum(1, state_); + } + if (createTime_ != null) { + output.writeMessage(2, getCreateTime()); + } + if (updateTime_ != null) { + output.writeMessage(3, getUpdateTime()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (state_ != com.google.webrisk.v1.SubmitUriMetadata.State.STATE_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, state_); + } + if (createTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getCreateTime()); + } + if (updateTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getUpdateTime()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.webrisk.v1.SubmitUriMetadata)) { + return super.equals(obj); + } + com.google.webrisk.v1.SubmitUriMetadata other = (com.google.webrisk.v1.SubmitUriMetadata) obj; + + if (state_ != other.state_) return false; + if (hasCreateTime() != other.hasCreateTime()) return false; + if (hasCreateTime()) { + if (!getCreateTime().equals(other.getCreateTime())) return false; + } + if (hasUpdateTime() != other.hasUpdateTime()) return false; + if (hasUpdateTime()) { + if (!getUpdateTime().equals(other.getUpdateTime())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + STATE_FIELD_NUMBER; + hash = (53 * hash) + state_; + if (hasCreateTime()) { + hash = (37 * hash) + CREATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getCreateTime().hashCode(); + } + if (hasUpdateTime()) { + hash = (37 * hash) + UPDATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getUpdateTime().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.webrisk.v1.SubmitUriMetadata parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.SubmitUriMetadata parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.SubmitUriMetadata parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.SubmitUriMetadata parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.SubmitUriMetadata parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.SubmitUriMetadata parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.SubmitUriMetadata parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.SubmitUriMetadata parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.webrisk.v1.SubmitUriMetadata parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.SubmitUriMetadata parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.webrisk.v1.SubmitUriMetadata parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.SubmitUriMetadata parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.webrisk.v1.SubmitUriMetadata prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Metadata for the Submit URI long-running operation.
+   * option (google.api.message_visibility).restriction = "TRUSTED_TESTER";
+   * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.SubmitUriMetadata} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.webrisk.v1.SubmitUriMetadata) + com.google.webrisk.v1.SubmitUriMetadataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SubmitUriMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SubmitUriMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.SubmitUriMetadata.class, + com.google.webrisk.v1.SubmitUriMetadata.Builder.class); + } + + // Construct using com.google.webrisk.v1.SubmitUriMetadata.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + state_ = 0; + createTime_ = null; + if (createTimeBuilder_ != null) { + createTimeBuilder_.dispose(); + createTimeBuilder_ = null; + } + updateTime_ = null; + if (updateTimeBuilder_ != null) { + updateTimeBuilder_.dispose(); + updateTimeBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SubmitUriMetadata_descriptor; + } + + @java.lang.Override + public com.google.webrisk.v1.SubmitUriMetadata getDefaultInstanceForType() { + return com.google.webrisk.v1.SubmitUriMetadata.getDefaultInstance(); + } + + @java.lang.Override + public com.google.webrisk.v1.SubmitUriMetadata build() { + com.google.webrisk.v1.SubmitUriMetadata result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.webrisk.v1.SubmitUriMetadata buildPartial() { + com.google.webrisk.v1.SubmitUriMetadata result = + new com.google.webrisk.v1.SubmitUriMetadata(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.webrisk.v1.SubmitUriMetadata result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.state_ = state_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.createTime_ = createTimeBuilder_ == null ? createTime_ : createTimeBuilder_.build(); + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.updateTime_ = updateTimeBuilder_ == null ? updateTime_ : updateTimeBuilder_.build(); + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.webrisk.v1.SubmitUriMetadata) { + return mergeFrom((com.google.webrisk.v1.SubmitUriMetadata) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.webrisk.v1.SubmitUriMetadata other) { + if (other == com.google.webrisk.v1.SubmitUriMetadata.getDefaultInstance()) return this; + if (other.state_ != 0) { + setStateValue(other.getStateValue()); + } + if (other.hasCreateTime()) { + mergeCreateTime(other.getCreateTime()); + } + if (other.hasUpdateTime()) { + mergeUpdateTime(other.getUpdateTime()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + state_ = input.readEnum(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 18: + { + input.readMessage(getCreateTimeFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + input.readMessage(getUpdateTimeFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private int state_ = 0; + /** + * + * + *
+     * The state of the operation.
+     * 
+ * + * .google.cloud.webrisk.v1.SubmitUriMetadata.State state = 1; + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + /** + * + * + *
+     * The state of the operation.
+     * 
+ * + * .google.cloud.webrisk.v1.SubmitUriMetadata.State state = 1; + * + * @param value The enum numeric value on the wire for state to set. + * @return This builder for chaining. + */ + public Builder setStateValue(int value) { + state_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * The state of the operation.
+     * 
+ * + * .google.cloud.webrisk.v1.SubmitUriMetadata.State state = 1; + * + * @return The state. + */ + @java.lang.Override + public com.google.webrisk.v1.SubmitUriMetadata.State getState() { + com.google.webrisk.v1.SubmitUriMetadata.State result = + com.google.webrisk.v1.SubmitUriMetadata.State.forNumber(state_); + return result == null ? com.google.webrisk.v1.SubmitUriMetadata.State.UNRECOGNIZED : result; + } + /** + * + * + *
+     * The state of the operation.
+     * 
+ * + * .google.cloud.webrisk.v1.SubmitUriMetadata.State state = 1; + * + * @param value The state to set. + * @return This builder for chaining. + */ + public Builder setState(com.google.webrisk.v1.SubmitUriMetadata.State value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + state_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * The state of the operation.
+     * 
+ * + * .google.cloud.webrisk.v1.SubmitUriMetadata.State state = 1; + * + * @return This builder for chaining. + */ + public Builder clearState() { + bitField0_ = (bitField0_ & ~0x00000001); + state_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp createTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + createTimeBuilder_; + /** + * + * + *
+     * Creation time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 2; + * + * @return Whether the createTime field is set. + */ + public boolean hasCreateTime() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+     * Creation time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 2; + * + * @return The createTime. + */ + public com.google.protobuf.Timestamp getCreateTime() { + if (createTimeBuilder_ == null) { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } else { + return createTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Creation time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + public Builder setCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + createTime_ = value; + } else { + createTimeBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Creation time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + public Builder setCreateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (createTimeBuilder_ == null) { + createTime_ = builderForValue.build(); + } else { + createTimeBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Creation time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + public Builder mergeCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) + && createTime_ != null + && createTime_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getCreateTimeBuilder().mergeFrom(value); + } else { + createTime_ = value; + } + } else { + createTimeBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Creation time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + public Builder clearCreateTime() { + bitField0_ = (bitField0_ & ~0x00000002); + createTime_ = null; + if (createTimeBuilder_ != null) { + createTimeBuilder_.dispose(); + createTimeBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Creation time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + public com.google.protobuf.Timestamp.Builder getCreateTimeBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getCreateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Creation time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + if (createTimeBuilder_ != null) { + return createTimeBuilder_.getMessageOrBuilder(); + } else { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } + } + /** + * + * + *
+     * Creation time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getCreateTimeFieldBuilder() { + if (createTimeBuilder_ == null) { + createTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getCreateTime(), getParentForChildren(), isClean()); + createTime_ = null; + } + return createTimeBuilder_; + } + + private com.google.protobuf.Timestamp updateTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + updateTimeBuilder_; + /** + * + * + *
+     * Latest update time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 3; + * + * @return Whether the updateTime field is set. + */ + public boolean hasUpdateTime() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * + * + *
+     * Latest update time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 3; + * + * @return The updateTime. + */ + public com.google.protobuf.Timestamp getUpdateTime() { + if (updateTimeBuilder_ == null) { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } else { + return updateTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Latest update time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 3; + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateTime_ = value; + } else { + updateTimeBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Latest update time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 3; + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (updateTimeBuilder_ == null) { + updateTime_ = builderForValue.build(); + } else { + updateTimeBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Latest update time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 3; + */ + public Builder mergeUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) + && updateTime_ != null + && updateTime_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getUpdateTimeBuilder().mergeFrom(value); + } else { + updateTime_ = value; + } + } else { + updateTimeBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Latest update time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 3; + */ + public Builder clearUpdateTime() { + bitField0_ = (bitField0_ & ~0x00000004); + updateTime_ = null; + if (updateTimeBuilder_ != null) { + updateTimeBuilder_.dispose(); + updateTimeBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Latest update time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 3; + */ + public com.google.protobuf.Timestamp.Builder getUpdateTimeBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getUpdateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Latest update time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 3; + */ + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + if (updateTimeBuilder_ != null) { + return updateTimeBuilder_.getMessageOrBuilder(); + } else { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } + } + /** + * + * + *
+     * Latest update time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getUpdateTimeFieldBuilder() { + if (updateTimeBuilder_ == null) { + updateTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getUpdateTime(), getParentForChildren(), isClean()); + updateTime_ = null; + } + return updateTimeBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.webrisk.v1.SubmitUriMetadata) + } + + // @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.SubmitUriMetadata) + private static final com.google.webrisk.v1.SubmitUriMetadata DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.webrisk.v1.SubmitUriMetadata(); + } + + public static com.google.webrisk.v1.SubmitUriMetadata getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SubmitUriMetadata parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.webrisk.v1.SubmitUriMetadata getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SubmitUriMetadataOrBuilder.java b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SubmitUriMetadataOrBuilder.java new file mode 100644 index 000000000000..8095a4dd60b3 --- /dev/null +++ b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SubmitUriMetadataOrBuilder.java @@ -0,0 +1,120 @@ +/* + * 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 + * + * 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/webrisk/v1/webrisk.proto + +package com.google.webrisk.v1; + +public interface SubmitUriMetadataOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.webrisk.v1.SubmitUriMetadata) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The state of the operation.
+   * 
+ * + * .google.cloud.webrisk.v1.SubmitUriMetadata.State state = 1; + * + * @return The enum numeric value on the wire for state. + */ + int getStateValue(); + /** + * + * + *
+   * The state of the operation.
+   * 
+ * + * .google.cloud.webrisk.v1.SubmitUriMetadata.State state = 1; + * + * @return The state. + */ + com.google.webrisk.v1.SubmitUriMetadata.State getState(); + + /** + * + * + *
+   * Creation time of the operation.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 2; + * + * @return Whether the createTime field is set. + */ + boolean hasCreateTime(); + /** + * + * + *
+   * Creation time of the operation.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 2; + * + * @return The createTime. + */ + com.google.protobuf.Timestamp getCreateTime(); + /** + * + * + *
+   * Creation time of the operation.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder(); + + /** + * + * + *
+   * Latest update time of the operation.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 3; + * + * @return Whether the updateTime field is set. + */ + boolean hasUpdateTime(); + /** + * + * + *
+   * Latest update time of the operation.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 3; + * + * @return The updateTime. + */ + com.google.protobuf.Timestamp getUpdateTime(); + /** + * + * + *
+   * Latest update time of the operation.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 3; + */ + com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder(); +} diff --git a/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SubmitUriRequest.java b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SubmitUriRequest.java new file mode 100644 index 000000000000..b761990ba1d0 --- /dev/null +++ b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SubmitUriRequest.java @@ -0,0 +1,1466 @@ +/* + * 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 + * + * 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/webrisk/v1/webrisk.proto + +package com.google.webrisk.v1; + +/** + * + * + *
+ * Request to send a potentially malicious URI to WebRisk.
+ * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.SubmitUriRequest} + */ +public final class SubmitUriRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.webrisk.v1.SubmitUriRequest) + SubmitUriRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use SubmitUriRequest.newBuilder() to construct. + private SubmitUriRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private SubmitUriRequest() { + parent_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new SubmitUriRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SubmitUriRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SubmitUriRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.SubmitUriRequest.class, + com.google.webrisk.v1.SubmitUriRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object parent_ = ""; + /** + * + * + *
+   * Required. The name of the project that is making the submission. This
+   * string is in the format "projects/{project_number}".
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the project that is making the submission. This
+   * string is in the format "projects/{project_number}".
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SUBMISSION_FIELD_NUMBER = 2; + private com.google.webrisk.v1.Submission submission_; + /** + * + * + *
+   * Required. The submission that contains the URI to be scanned.
+   * 
+ * + * + * .google.cloud.webrisk.v1.Submission submission = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the submission field is set. + */ + @java.lang.Override + public boolean hasSubmission() { + return submission_ != null; + } + /** + * + * + *
+   * Required. The submission that contains the URI to be scanned.
+   * 
+ * + * + * .google.cloud.webrisk.v1.Submission submission = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The submission. + */ + @java.lang.Override + public com.google.webrisk.v1.Submission getSubmission() { + return submission_ == null + ? com.google.webrisk.v1.Submission.getDefaultInstance() + : submission_; + } + /** + * + * + *
+   * Required. The submission that contains the URI to be scanned.
+   * 
+ * + * + * .google.cloud.webrisk.v1.Submission submission = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.webrisk.v1.SubmissionOrBuilder getSubmissionOrBuilder() { + return submission_ == null + ? com.google.webrisk.v1.Submission.getDefaultInstance() + : submission_; + } + + public static final int THREAT_INFO_FIELD_NUMBER = 3; + private com.google.webrisk.v1.ThreatInfo threatInfo_; + /** + * + * + *
+   * Provides additional information about the submission.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo threat_info = 3; + * + * @return Whether the threatInfo field is set. + */ + @java.lang.Override + public boolean hasThreatInfo() { + return threatInfo_ != null; + } + /** + * + * + *
+   * Provides additional information about the submission.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo threat_info = 3; + * + * @return The threatInfo. + */ + @java.lang.Override + public com.google.webrisk.v1.ThreatInfo getThreatInfo() { + return threatInfo_ == null + ? com.google.webrisk.v1.ThreatInfo.getDefaultInstance() + : threatInfo_; + } + /** + * + * + *
+   * Provides additional information about the submission.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo threat_info = 3; + */ + @java.lang.Override + public com.google.webrisk.v1.ThreatInfoOrBuilder getThreatInfoOrBuilder() { + return threatInfo_ == null + ? com.google.webrisk.v1.ThreatInfo.getDefaultInstance() + : threatInfo_; + } + + public static final int THREAT_DISCOVERY_FIELD_NUMBER = 4; + private com.google.webrisk.v1.ThreatDiscovery threatDiscovery_; + /** + * + * + *
+   * Provides additional information about how the submission was discovered.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatDiscovery threat_discovery = 4; + * + * @return Whether the threatDiscovery field is set. + */ + @java.lang.Override + public boolean hasThreatDiscovery() { + return threatDiscovery_ != null; + } + /** + * + * + *
+   * Provides additional information about how the submission was discovered.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatDiscovery threat_discovery = 4; + * + * @return The threatDiscovery. + */ + @java.lang.Override + public com.google.webrisk.v1.ThreatDiscovery getThreatDiscovery() { + return threatDiscovery_ == null + ? com.google.webrisk.v1.ThreatDiscovery.getDefaultInstance() + : threatDiscovery_; + } + /** + * + * + *
+   * Provides additional information about how the submission was discovered.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatDiscovery threat_discovery = 4; + */ + @java.lang.Override + public com.google.webrisk.v1.ThreatDiscoveryOrBuilder getThreatDiscoveryOrBuilder() { + return threatDiscovery_ == null + ? com.google.webrisk.v1.ThreatDiscovery.getDefaultInstance() + : threatDiscovery_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (submission_ != null) { + output.writeMessage(2, getSubmission()); + } + if (threatInfo_ != null) { + output.writeMessage(3, getThreatInfo()); + } + if (threatDiscovery_ != null) { + output.writeMessage(4, getThreatDiscovery()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (submission_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getSubmission()); + } + if (threatInfo_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getThreatInfo()); + } + if (threatDiscovery_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getThreatDiscovery()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.webrisk.v1.SubmitUriRequest)) { + return super.equals(obj); + } + com.google.webrisk.v1.SubmitUriRequest other = (com.google.webrisk.v1.SubmitUriRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (hasSubmission() != other.hasSubmission()) return false; + if (hasSubmission()) { + if (!getSubmission().equals(other.getSubmission())) return false; + } + if (hasThreatInfo() != other.hasThreatInfo()) return false; + if (hasThreatInfo()) { + if (!getThreatInfo().equals(other.getThreatInfo())) return false; + } + if (hasThreatDiscovery() != other.hasThreatDiscovery()) return false; + if (hasThreatDiscovery()) { + if (!getThreatDiscovery().equals(other.getThreatDiscovery())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + if (hasSubmission()) { + hash = (37 * hash) + SUBMISSION_FIELD_NUMBER; + hash = (53 * hash) + getSubmission().hashCode(); + } + if (hasThreatInfo()) { + hash = (37 * hash) + THREAT_INFO_FIELD_NUMBER; + hash = (53 * hash) + getThreatInfo().hashCode(); + } + if (hasThreatDiscovery()) { + hash = (37 * hash) + THREAT_DISCOVERY_FIELD_NUMBER; + hash = (53 * hash) + getThreatDiscovery().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.webrisk.v1.SubmitUriRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.SubmitUriRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.SubmitUriRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.SubmitUriRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.SubmitUriRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.SubmitUriRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.SubmitUriRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.SubmitUriRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.webrisk.v1.SubmitUriRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.SubmitUriRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.webrisk.v1.SubmitUriRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.SubmitUriRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.webrisk.v1.SubmitUriRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request to send a potentially malicious URI to WebRisk.
+   * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.SubmitUriRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.webrisk.v1.SubmitUriRequest) + com.google.webrisk.v1.SubmitUriRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SubmitUriRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SubmitUriRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.SubmitUriRequest.class, + com.google.webrisk.v1.SubmitUriRequest.Builder.class); + } + + // Construct using com.google.webrisk.v1.SubmitUriRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + parent_ = ""; + submission_ = null; + if (submissionBuilder_ != null) { + submissionBuilder_.dispose(); + submissionBuilder_ = null; + } + threatInfo_ = null; + if (threatInfoBuilder_ != null) { + threatInfoBuilder_.dispose(); + threatInfoBuilder_ = null; + } + threatDiscovery_ = null; + if (threatDiscoveryBuilder_ != null) { + threatDiscoveryBuilder_.dispose(); + threatDiscoveryBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SubmitUriRequest_descriptor; + } + + @java.lang.Override + public com.google.webrisk.v1.SubmitUriRequest getDefaultInstanceForType() { + return com.google.webrisk.v1.SubmitUriRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.webrisk.v1.SubmitUriRequest build() { + com.google.webrisk.v1.SubmitUriRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.webrisk.v1.SubmitUriRequest buildPartial() { + com.google.webrisk.v1.SubmitUriRequest result = + new com.google.webrisk.v1.SubmitUriRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.webrisk.v1.SubmitUriRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.parent_ = parent_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.submission_ = submissionBuilder_ == null ? submission_ : submissionBuilder_.build(); + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.threatInfo_ = threatInfoBuilder_ == null ? threatInfo_ : threatInfoBuilder_.build(); + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.threatDiscovery_ = + threatDiscoveryBuilder_ == null ? threatDiscovery_ : threatDiscoveryBuilder_.build(); + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.webrisk.v1.SubmitUriRequest) { + return mergeFrom((com.google.webrisk.v1.SubmitUriRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.webrisk.v1.SubmitUriRequest other) { + if (other == com.google.webrisk.v1.SubmitUriRequest.getDefaultInstance()) return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (other.hasSubmission()) { + mergeSubmission(other.getSubmission()); + } + if (other.hasThreatInfo()) { + mergeThreatInfo(other.getThreatInfo()); + } + if (other.hasThreatDiscovery()) { + mergeThreatDiscovery(other.getThreatDiscovery()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + parent_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + input.readMessage(getSubmissionFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + input.readMessage(getThreatInfoFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 34: + { + input.readMessage(getThreatDiscoveryFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000008; + break; + } // case 34 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The name of the project that is making the submission. This
+     * string is in the format "projects/{project_number}".
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the project that is making the submission. This
+     * string is in the format "projects/{project_number}".
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the project that is making the submission. This
+     * string is in the format "projects/{project_number}".
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + parent_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the project that is making the submission. This
+     * string is in the format "projects/{project_number}".
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + parent_ = getDefaultInstance().getParent(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the project that is making the submission. This
+     * string is in the format "projects/{project_number}".
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + parent_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private com.google.webrisk.v1.Submission submission_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.Submission, + com.google.webrisk.v1.Submission.Builder, + com.google.webrisk.v1.SubmissionOrBuilder> + submissionBuilder_; + /** + * + * + *
+     * Required. The submission that contains the URI to be scanned.
+     * 
+ * + * + * .google.cloud.webrisk.v1.Submission submission = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the submission field is set. + */ + public boolean hasSubmission() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+     * Required. The submission that contains the URI to be scanned.
+     * 
+ * + * + * .google.cloud.webrisk.v1.Submission submission = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The submission. + */ + public com.google.webrisk.v1.Submission getSubmission() { + if (submissionBuilder_ == null) { + return submission_ == null + ? com.google.webrisk.v1.Submission.getDefaultInstance() + : submission_; + } else { + return submissionBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The submission that contains the URI to be scanned.
+     * 
+ * + * + * .google.cloud.webrisk.v1.Submission submission = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setSubmission(com.google.webrisk.v1.Submission value) { + if (submissionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + submission_ = value; + } else { + submissionBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The submission that contains the URI to be scanned.
+     * 
+ * + * + * .google.cloud.webrisk.v1.Submission submission = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setSubmission(com.google.webrisk.v1.Submission.Builder builderForValue) { + if (submissionBuilder_ == null) { + submission_ = builderForValue.build(); + } else { + submissionBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The submission that contains the URI to be scanned.
+     * 
+ * + * + * .google.cloud.webrisk.v1.Submission submission = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeSubmission(com.google.webrisk.v1.Submission value) { + if (submissionBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) + && submission_ != null + && submission_ != com.google.webrisk.v1.Submission.getDefaultInstance()) { + getSubmissionBuilder().mergeFrom(value); + } else { + submission_ = value; + } + } else { + submissionBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The submission that contains the URI to be scanned.
+     * 
+ * + * + * .google.cloud.webrisk.v1.Submission submission = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearSubmission() { + bitField0_ = (bitField0_ & ~0x00000002); + submission_ = null; + if (submissionBuilder_ != null) { + submissionBuilder_.dispose(); + submissionBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The submission that contains the URI to be scanned.
+     * 
+ * + * + * .google.cloud.webrisk.v1.Submission submission = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.webrisk.v1.Submission.Builder getSubmissionBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getSubmissionFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The submission that contains the URI to be scanned.
+     * 
+ * + * + * .google.cloud.webrisk.v1.Submission submission = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.webrisk.v1.SubmissionOrBuilder getSubmissionOrBuilder() { + if (submissionBuilder_ != null) { + return submissionBuilder_.getMessageOrBuilder(); + } else { + return submission_ == null + ? com.google.webrisk.v1.Submission.getDefaultInstance() + : submission_; + } + } + /** + * + * + *
+     * Required. The submission that contains the URI to be scanned.
+     * 
+ * + * + * .google.cloud.webrisk.v1.Submission submission = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.Submission, + com.google.webrisk.v1.Submission.Builder, + com.google.webrisk.v1.SubmissionOrBuilder> + getSubmissionFieldBuilder() { + if (submissionBuilder_ == null) { + submissionBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.Submission, + com.google.webrisk.v1.Submission.Builder, + com.google.webrisk.v1.SubmissionOrBuilder>( + getSubmission(), getParentForChildren(), isClean()); + submission_ = null; + } + return submissionBuilder_; + } + + private com.google.webrisk.v1.ThreatInfo threatInfo_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.ThreatInfo, + com.google.webrisk.v1.ThreatInfo.Builder, + com.google.webrisk.v1.ThreatInfoOrBuilder> + threatInfoBuilder_; + /** + * + * + *
+     * Provides additional information about the submission.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo threat_info = 3; + * + * @return Whether the threatInfo field is set. + */ + public boolean hasThreatInfo() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * + * + *
+     * Provides additional information about the submission.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo threat_info = 3; + * + * @return The threatInfo. + */ + public com.google.webrisk.v1.ThreatInfo getThreatInfo() { + if (threatInfoBuilder_ == null) { + return threatInfo_ == null + ? com.google.webrisk.v1.ThreatInfo.getDefaultInstance() + : threatInfo_; + } else { + return threatInfoBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Provides additional information about the submission.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo threat_info = 3; + */ + public Builder setThreatInfo(com.google.webrisk.v1.ThreatInfo value) { + if (threatInfoBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + threatInfo_ = value; + } else { + threatInfoBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Provides additional information about the submission.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo threat_info = 3; + */ + public Builder setThreatInfo(com.google.webrisk.v1.ThreatInfo.Builder builderForValue) { + if (threatInfoBuilder_ == null) { + threatInfo_ = builderForValue.build(); + } else { + threatInfoBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Provides additional information about the submission.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo threat_info = 3; + */ + public Builder mergeThreatInfo(com.google.webrisk.v1.ThreatInfo value) { + if (threatInfoBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) + && threatInfo_ != null + && threatInfo_ != com.google.webrisk.v1.ThreatInfo.getDefaultInstance()) { + getThreatInfoBuilder().mergeFrom(value); + } else { + threatInfo_ = value; + } + } else { + threatInfoBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Provides additional information about the submission.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo threat_info = 3; + */ + public Builder clearThreatInfo() { + bitField0_ = (bitField0_ & ~0x00000004); + threatInfo_ = null; + if (threatInfoBuilder_ != null) { + threatInfoBuilder_.dispose(); + threatInfoBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Provides additional information about the submission.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo threat_info = 3; + */ + public com.google.webrisk.v1.ThreatInfo.Builder getThreatInfoBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getThreatInfoFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Provides additional information about the submission.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo threat_info = 3; + */ + public com.google.webrisk.v1.ThreatInfoOrBuilder getThreatInfoOrBuilder() { + if (threatInfoBuilder_ != null) { + return threatInfoBuilder_.getMessageOrBuilder(); + } else { + return threatInfo_ == null + ? com.google.webrisk.v1.ThreatInfo.getDefaultInstance() + : threatInfo_; + } + } + /** + * + * + *
+     * Provides additional information about the submission.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo threat_info = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.ThreatInfo, + com.google.webrisk.v1.ThreatInfo.Builder, + com.google.webrisk.v1.ThreatInfoOrBuilder> + getThreatInfoFieldBuilder() { + if (threatInfoBuilder_ == null) { + threatInfoBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.ThreatInfo, + com.google.webrisk.v1.ThreatInfo.Builder, + com.google.webrisk.v1.ThreatInfoOrBuilder>( + getThreatInfo(), getParentForChildren(), isClean()); + threatInfo_ = null; + } + return threatInfoBuilder_; + } + + private com.google.webrisk.v1.ThreatDiscovery threatDiscovery_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.ThreatDiscovery, + com.google.webrisk.v1.ThreatDiscovery.Builder, + com.google.webrisk.v1.ThreatDiscoveryOrBuilder> + threatDiscoveryBuilder_; + /** + * + * + *
+     * Provides additional information about how the submission was discovered.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatDiscovery threat_discovery = 4; + * + * @return Whether the threatDiscovery field is set. + */ + public boolean hasThreatDiscovery() { + return ((bitField0_ & 0x00000008) != 0); + } + /** + * + * + *
+     * Provides additional information about how the submission was discovered.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatDiscovery threat_discovery = 4; + * + * @return The threatDiscovery. + */ + public com.google.webrisk.v1.ThreatDiscovery getThreatDiscovery() { + if (threatDiscoveryBuilder_ == null) { + return threatDiscovery_ == null + ? com.google.webrisk.v1.ThreatDiscovery.getDefaultInstance() + : threatDiscovery_; + } else { + return threatDiscoveryBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Provides additional information about how the submission was discovered.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatDiscovery threat_discovery = 4; + */ + public Builder setThreatDiscovery(com.google.webrisk.v1.ThreatDiscovery value) { + if (threatDiscoveryBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + threatDiscovery_ = value; + } else { + threatDiscoveryBuilder_.setMessage(value); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * Provides additional information about how the submission was discovered.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatDiscovery threat_discovery = 4; + */ + public Builder setThreatDiscovery( + com.google.webrisk.v1.ThreatDiscovery.Builder builderForValue) { + if (threatDiscoveryBuilder_ == null) { + threatDiscovery_ = builderForValue.build(); + } else { + threatDiscoveryBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * Provides additional information about how the submission was discovered.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatDiscovery threat_discovery = 4; + */ + public Builder mergeThreatDiscovery(com.google.webrisk.v1.ThreatDiscovery value) { + if (threatDiscoveryBuilder_ == null) { + if (((bitField0_ & 0x00000008) != 0) + && threatDiscovery_ != null + && threatDiscovery_ != com.google.webrisk.v1.ThreatDiscovery.getDefaultInstance()) { + getThreatDiscoveryBuilder().mergeFrom(value); + } else { + threatDiscovery_ = value; + } + } else { + threatDiscoveryBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * Provides additional information about how the submission was discovered.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatDiscovery threat_discovery = 4; + */ + public Builder clearThreatDiscovery() { + bitField0_ = (bitField0_ & ~0x00000008); + threatDiscovery_ = null; + if (threatDiscoveryBuilder_ != null) { + threatDiscoveryBuilder_.dispose(); + threatDiscoveryBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Provides additional information about how the submission was discovered.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatDiscovery threat_discovery = 4; + */ + public com.google.webrisk.v1.ThreatDiscovery.Builder getThreatDiscoveryBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return getThreatDiscoveryFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Provides additional information about how the submission was discovered.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatDiscovery threat_discovery = 4; + */ + public com.google.webrisk.v1.ThreatDiscoveryOrBuilder getThreatDiscoveryOrBuilder() { + if (threatDiscoveryBuilder_ != null) { + return threatDiscoveryBuilder_.getMessageOrBuilder(); + } else { + return threatDiscovery_ == null + ? com.google.webrisk.v1.ThreatDiscovery.getDefaultInstance() + : threatDiscovery_; + } + } + /** + * + * + *
+     * Provides additional information about how the submission was discovered.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatDiscovery threat_discovery = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.ThreatDiscovery, + com.google.webrisk.v1.ThreatDiscovery.Builder, + com.google.webrisk.v1.ThreatDiscoveryOrBuilder> + getThreatDiscoveryFieldBuilder() { + if (threatDiscoveryBuilder_ == null) { + threatDiscoveryBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.ThreatDiscovery, + com.google.webrisk.v1.ThreatDiscovery.Builder, + com.google.webrisk.v1.ThreatDiscoveryOrBuilder>( + getThreatDiscovery(), getParentForChildren(), isClean()); + threatDiscovery_ = null; + } + return threatDiscoveryBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.webrisk.v1.SubmitUriRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.SubmitUriRequest) + private static final com.google.webrisk.v1.SubmitUriRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.webrisk.v1.SubmitUriRequest(); + } + + public static com.google.webrisk.v1.SubmitUriRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SubmitUriRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.webrisk.v1.SubmitUriRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SubmitUriRequestOrBuilder.java b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SubmitUriRequestOrBuilder.java new file mode 100644 index 000000000000..de08d1ce71fa --- /dev/null +++ b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SubmitUriRequestOrBuilder.java @@ -0,0 +1,167 @@ +/* + * 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 + * + * 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/webrisk/v1/webrisk.proto + +package com.google.webrisk.v1; + +public interface SubmitUriRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.webrisk.v1.SubmitUriRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the project that is making the submission. This
+   * string is in the format "projects/{project_number}".
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The name of the project that is making the submission. This
+   * string is in the format "projects/{project_number}".
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Required. The submission that contains the URI to be scanned.
+   * 
+ * + * + * .google.cloud.webrisk.v1.Submission submission = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the submission field is set. + */ + boolean hasSubmission(); + /** + * + * + *
+   * Required. The submission that contains the URI to be scanned.
+   * 
+ * + * + * .google.cloud.webrisk.v1.Submission submission = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The submission. + */ + com.google.webrisk.v1.Submission getSubmission(); + /** + * + * + *
+   * Required. The submission that contains the URI to be scanned.
+   * 
+ * + * + * .google.cloud.webrisk.v1.Submission submission = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.webrisk.v1.SubmissionOrBuilder getSubmissionOrBuilder(); + + /** + * + * + *
+   * Provides additional information about the submission.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo threat_info = 3; + * + * @return Whether the threatInfo field is set. + */ + boolean hasThreatInfo(); + /** + * + * + *
+   * Provides additional information about the submission.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo threat_info = 3; + * + * @return The threatInfo. + */ + com.google.webrisk.v1.ThreatInfo getThreatInfo(); + /** + * + * + *
+   * Provides additional information about the submission.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo threat_info = 3; + */ + com.google.webrisk.v1.ThreatInfoOrBuilder getThreatInfoOrBuilder(); + + /** + * + * + *
+   * Provides additional information about how the submission was discovered.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatDiscovery threat_discovery = 4; + * + * @return Whether the threatDiscovery field is set. + */ + boolean hasThreatDiscovery(); + /** + * + * + *
+   * Provides additional information about how the submission was discovered.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatDiscovery threat_discovery = 4; + * + * @return The threatDiscovery. + */ + com.google.webrisk.v1.ThreatDiscovery getThreatDiscovery(); + /** + * + * + *
+   * Provides additional information about how the submission was discovered.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatDiscovery threat_discovery = 4; + */ + com.google.webrisk.v1.ThreatDiscoveryOrBuilder getThreatDiscoveryOrBuilder(); +} diff --git a/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatDiscovery.java b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatDiscovery.java new file mode 100644 index 000000000000..62c915ddad33 --- /dev/null +++ b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatDiscovery.java @@ -0,0 +1,1084 @@ +/* + * 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 + * + * 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/webrisk/v1/webrisk.proto + +package com.google.webrisk.v1; + +/** + * + * + *
+ * Details about how the threat was discovered.
+ * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.ThreatDiscovery} + */ +public final class ThreatDiscovery extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.webrisk.v1.ThreatDiscovery) + ThreatDiscoveryOrBuilder { + private static final long serialVersionUID = 0L; + // Use ThreatDiscovery.newBuilder() to construct. + private ThreatDiscovery(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ThreatDiscovery() { + platform_ = 0; + regionCodes_ = com.google.protobuf.LazyStringArrayList.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ThreatDiscovery(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ThreatDiscovery_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ThreatDiscovery_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.ThreatDiscovery.class, + com.google.webrisk.v1.ThreatDiscovery.Builder.class); + } + + /** + * + * + *
+   * Platform types.
+   * 
+ * + * Protobuf enum {@code google.cloud.webrisk.v1.ThreatDiscovery.Platform} + */ + public enum Platform implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Default.
+     * 
+ * + * PLATFORM_UNSPECIFIED = 0; + */ + PLATFORM_UNSPECIFIED(0), + /** + * + * + *
+     * General Android platform.
+     * 
+ * + * ANDROID = 1; + */ + ANDROID(1), + /** + * + * + *
+     * General iOS platform.
+     * 
+ * + * IOS = 2; + */ + IOS(2), + /** + * + * + *
+     * General macOS platform.
+     * 
+ * + * MACOS = 3; + */ + MACOS(3), + /** + * + * + *
+     * General Windows platform.
+     * 
+ * + * WINDOWS = 4; + */ + WINDOWS(4), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Default.
+     * 
+ * + * PLATFORM_UNSPECIFIED = 0; + */ + public static final int PLATFORM_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * General Android platform.
+     * 
+ * + * ANDROID = 1; + */ + public static final int ANDROID_VALUE = 1; + /** + * + * + *
+     * General iOS platform.
+     * 
+ * + * IOS = 2; + */ + public static final int IOS_VALUE = 2; + /** + * + * + *
+     * General macOS platform.
+     * 
+ * + * MACOS = 3; + */ + public static final int MACOS_VALUE = 3; + /** + * + * + *
+     * General Windows platform.
+     * 
+ * + * WINDOWS = 4; + */ + public static final int WINDOWS_VALUE = 4; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static Platform valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static Platform forNumber(int value) { + switch (value) { + case 0: + return PLATFORM_UNSPECIFIED; + case 1: + return ANDROID; + case 2: + return IOS; + case 3: + return MACOS; + case 4: + return WINDOWS; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public Platform findValueByNumber(int number) { + return Platform.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.webrisk.v1.ThreatDiscovery.getDescriptor().getEnumTypes().get(0); + } + + private static final Platform[] VALUES = values(); + + public static Platform valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private Platform(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.webrisk.v1.ThreatDiscovery.Platform) + } + + public static final int PLATFORM_FIELD_NUMBER = 1; + private int platform_ = 0; + /** + * + * + *
+   * Platform on which the threat was discovered.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatDiscovery.Platform platform = 1; + * + * @return The enum numeric value on the wire for platform. + */ + @java.lang.Override + public int getPlatformValue() { + return platform_; + } + /** + * + * + *
+   * Platform on which the threat was discovered.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatDiscovery.Platform platform = 1; + * + * @return The platform. + */ + @java.lang.Override + public com.google.webrisk.v1.ThreatDiscovery.Platform getPlatform() { + com.google.webrisk.v1.ThreatDiscovery.Platform result = + com.google.webrisk.v1.ThreatDiscovery.Platform.forNumber(platform_); + return result == null ? com.google.webrisk.v1.ThreatDiscovery.Platform.UNRECOGNIZED : result; + } + + public static final int REGION_CODES_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringList regionCodes_; + /** + * + * + *
+   * CLDR region code of the countries/regions the URI poses a threat ordered
+   * from most impact to least impact. Example: "US" for United States.
+   * 
+ * + * repeated string region_codes = 2; + * + * @return A list containing the regionCodes. + */ + public com.google.protobuf.ProtocolStringList getRegionCodesList() { + return regionCodes_; + } + /** + * + * + *
+   * CLDR region code of the countries/regions the URI poses a threat ordered
+   * from most impact to least impact. Example: "US" for United States.
+   * 
+ * + * repeated string region_codes = 2; + * + * @return The count of regionCodes. + */ + public int getRegionCodesCount() { + return regionCodes_.size(); + } + /** + * + * + *
+   * CLDR region code of the countries/regions the URI poses a threat ordered
+   * from most impact to least impact. Example: "US" for United States.
+   * 
+ * + * repeated string region_codes = 2; + * + * @param index The index of the element to return. + * @return The regionCodes at the given index. + */ + public java.lang.String getRegionCodes(int index) { + return regionCodes_.get(index); + } + /** + * + * + *
+   * CLDR region code of the countries/regions the URI poses a threat ordered
+   * from most impact to least impact. Example: "US" for United States.
+   * 
+ * + * repeated string region_codes = 2; + * + * @param index The index of the value to return. + * @return The bytes of the regionCodes at the given index. + */ + public com.google.protobuf.ByteString getRegionCodesBytes(int index) { + return regionCodes_.getByteString(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (platform_ + != com.google.webrisk.v1.ThreatDiscovery.Platform.PLATFORM_UNSPECIFIED.getNumber()) { + output.writeEnum(1, platform_); + } + for (int i = 0; i < regionCodes_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, regionCodes_.getRaw(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (platform_ + != com.google.webrisk.v1.ThreatDiscovery.Platform.PLATFORM_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, platform_); + } + { + int dataSize = 0; + for (int i = 0; i < regionCodes_.size(); i++) { + dataSize += computeStringSizeNoTag(regionCodes_.getRaw(i)); + } + size += dataSize; + size += 1 * getRegionCodesList().size(); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.webrisk.v1.ThreatDiscovery)) { + return super.equals(obj); + } + com.google.webrisk.v1.ThreatDiscovery other = (com.google.webrisk.v1.ThreatDiscovery) obj; + + if (platform_ != other.platform_) return false; + if (!getRegionCodesList().equals(other.getRegionCodesList())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PLATFORM_FIELD_NUMBER; + hash = (53 * hash) + platform_; + if (getRegionCodesCount() > 0) { + hash = (37 * hash) + REGION_CODES_FIELD_NUMBER; + hash = (53 * hash) + getRegionCodesList().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.webrisk.v1.ThreatDiscovery parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.ThreatDiscovery parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.ThreatDiscovery parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.ThreatDiscovery parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.ThreatDiscovery parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.ThreatDiscovery parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.ThreatDiscovery parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.ThreatDiscovery parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.webrisk.v1.ThreatDiscovery parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.ThreatDiscovery parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.webrisk.v1.ThreatDiscovery parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.ThreatDiscovery parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.webrisk.v1.ThreatDiscovery prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Details about how the threat was discovered.
+   * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.ThreatDiscovery} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.webrisk.v1.ThreatDiscovery) + com.google.webrisk.v1.ThreatDiscoveryOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ThreatDiscovery_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ThreatDiscovery_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.ThreatDiscovery.class, + com.google.webrisk.v1.ThreatDiscovery.Builder.class); + } + + // Construct using com.google.webrisk.v1.ThreatDiscovery.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + platform_ = 0; + regionCodes_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ThreatDiscovery_descriptor; + } + + @java.lang.Override + public com.google.webrisk.v1.ThreatDiscovery getDefaultInstanceForType() { + return com.google.webrisk.v1.ThreatDiscovery.getDefaultInstance(); + } + + @java.lang.Override + public com.google.webrisk.v1.ThreatDiscovery build() { + com.google.webrisk.v1.ThreatDiscovery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.webrisk.v1.ThreatDiscovery buildPartial() { + com.google.webrisk.v1.ThreatDiscovery result = + new com.google.webrisk.v1.ThreatDiscovery(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(com.google.webrisk.v1.ThreatDiscovery result) { + if (((bitField0_ & 0x00000002) != 0)) { + regionCodes_ = regionCodes_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.regionCodes_ = regionCodes_; + } + + private void buildPartial0(com.google.webrisk.v1.ThreatDiscovery result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.platform_ = platform_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.webrisk.v1.ThreatDiscovery) { + return mergeFrom((com.google.webrisk.v1.ThreatDiscovery) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.webrisk.v1.ThreatDiscovery other) { + if (other == com.google.webrisk.v1.ThreatDiscovery.getDefaultInstance()) return this; + if (other.platform_ != 0) { + setPlatformValue(other.getPlatformValue()); + } + if (!other.regionCodes_.isEmpty()) { + if (regionCodes_.isEmpty()) { + regionCodes_ = other.regionCodes_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureRegionCodesIsMutable(); + regionCodes_.addAll(other.regionCodes_); + } + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + platform_ = input.readEnum(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + ensureRegionCodesIsMutable(); + regionCodes_.add(s); + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private int platform_ = 0; + /** + * + * + *
+     * Platform on which the threat was discovered.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatDiscovery.Platform platform = 1; + * + * @return The enum numeric value on the wire for platform. + */ + @java.lang.Override + public int getPlatformValue() { + return platform_; + } + /** + * + * + *
+     * Platform on which the threat was discovered.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatDiscovery.Platform platform = 1; + * + * @param value The enum numeric value on the wire for platform to set. + * @return This builder for chaining. + */ + public Builder setPlatformValue(int value) { + platform_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Platform on which the threat was discovered.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatDiscovery.Platform platform = 1; + * + * @return The platform. + */ + @java.lang.Override + public com.google.webrisk.v1.ThreatDiscovery.Platform getPlatform() { + com.google.webrisk.v1.ThreatDiscovery.Platform result = + com.google.webrisk.v1.ThreatDiscovery.Platform.forNumber(platform_); + return result == null ? com.google.webrisk.v1.ThreatDiscovery.Platform.UNRECOGNIZED : result; + } + /** + * + * + *
+     * Platform on which the threat was discovered.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatDiscovery.Platform platform = 1; + * + * @param value The platform to set. + * @return This builder for chaining. + */ + public Builder setPlatform(com.google.webrisk.v1.ThreatDiscovery.Platform value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + platform_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * Platform on which the threat was discovered.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatDiscovery.Platform platform = 1; + * + * @return This builder for chaining. + */ + public Builder clearPlatform() { + bitField0_ = (bitField0_ & ~0x00000001); + platform_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList regionCodes_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureRegionCodesIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + regionCodes_ = new com.google.protobuf.LazyStringArrayList(regionCodes_); + bitField0_ |= 0x00000002; + } + } + /** + * + * + *
+     * CLDR region code of the countries/regions the URI poses a threat ordered
+     * from most impact to least impact. Example: "US" for United States.
+     * 
+ * + * repeated string region_codes = 2; + * + * @return A list containing the regionCodes. + */ + public com.google.protobuf.ProtocolStringList getRegionCodesList() { + return regionCodes_.getUnmodifiableView(); + } + /** + * + * + *
+     * CLDR region code of the countries/regions the URI poses a threat ordered
+     * from most impact to least impact. Example: "US" for United States.
+     * 
+ * + * repeated string region_codes = 2; + * + * @return The count of regionCodes. + */ + public int getRegionCodesCount() { + return regionCodes_.size(); + } + /** + * + * + *
+     * CLDR region code of the countries/regions the URI poses a threat ordered
+     * from most impact to least impact. Example: "US" for United States.
+     * 
+ * + * repeated string region_codes = 2; + * + * @param index The index of the element to return. + * @return The regionCodes at the given index. + */ + public java.lang.String getRegionCodes(int index) { + return regionCodes_.get(index); + } + /** + * + * + *
+     * CLDR region code of the countries/regions the URI poses a threat ordered
+     * from most impact to least impact. Example: "US" for United States.
+     * 
+ * + * repeated string region_codes = 2; + * + * @param index The index of the value to return. + * @return The bytes of the regionCodes at the given index. + */ + public com.google.protobuf.ByteString getRegionCodesBytes(int index) { + return regionCodes_.getByteString(index); + } + /** + * + * + *
+     * CLDR region code of the countries/regions the URI poses a threat ordered
+     * from most impact to least impact. Example: "US" for United States.
+     * 
+ * + * repeated string region_codes = 2; + * + * @param index The index to set the value at. + * @param value The regionCodes to set. + * @return This builder for chaining. + */ + public Builder setRegionCodes(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureRegionCodesIsMutable(); + regionCodes_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * CLDR region code of the countries/regions the URI poses a threat ordered
+     * from most impact to least impact. Example: "US" for United States.
+     * 
+ * + * repeated string region_codes = 2; + * + * @param value The regionCodes to add. + * @return This builder for chaining. + */ + public Builder addRegionCodes(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureRegionCodesIsMutable(); + regionCodes_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * CLDR region code of the countries/regions the URI poses a threat ordered
+     * from most impact to least impact. Example: "US" for United States.
+     * 
+ * + * repeated string region_codes = 2; + * + * @param values The regionCodes to add. + * @return This builder for chaining. + */ + public Builder addAllRegionCodes(java.lang.Iterable values) { + ensureRegionCodesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, regionCodes_); + onChanged(); + return this; + } + /** + * + * + *
+     * CLDR region code of the countries/regions the URI poses a threat ordered
+     * from most impact to least impact. Example: "US" for United States.
+     * 
+ * + * repeated string region_codes = 2; + * + * @return This builder for chaining. + */ + public Builder clearRegionCodes() { + regionCodes_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * CLDR region code of the countries/regions the URI poses a threat ordered
+     * from most impact to least impact. Example: "US" for United States.
+     * 
+ * + * repeated string region_codes = 2; + * + * @param value The bytes of the regionCodes to add. + * @return This builder for chaining. + */ + public Builder addRegionCodesBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureRegionCodesIsMutable(); + regionCodes_.add(value); + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.webrisk.v1.ThreatDiscovery) + } + + // @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.ThreatDiscovery) + private static final com.google.webrisk.v1.ThreatDiscovery DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.webrisk.v1.ThreatDiscovery(); + } + + public static com.google.webrisk.v1.ThreatDiscovery getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ThreatDiscovery parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.webrisk.v1.ThreatDiscovery getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatDiscoveryOrBuilder.java b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatDiscoveryOrBuilder.java new file mode 100644 index 000000000000..b8e378144cfe --- /dev/null +++ b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatDiscoveryOrBuilder.java @@ -0,0 +1,105 @@ +/* + * 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 + * + * 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/webrisk/v1/webrisk.proto + +package com.google.webrisk.v1; + +public interface ThreatDiscoveryOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.webrisk.v1.ThreatDiscovery) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Platform on which the threat was discovered.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatDiscovery.Platform platform = 1; + * + * @return The enum numeric value on the wire for platform. + */ + int getPlatformValue(); + /** + * + * + *
+   * Platform on which the threat was discovered.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatDiscovery.Platform platform = 1; + * + * @return The platform. + */ + com.google.webrisk.v1.ThreatDiscovery.Platform getPlatform(); + + /** + * + * + *
+   * CLDR region code of the countries/regions the URI poses a threat ordered
+   * from most impact to least impact. Example: "US" for United States.
+   * 
+ * + * repeated string region_codes = 2; + * + * @return A list containing the regionCodes. + */ + java.util.List getRegionCodesList(); + /** + * + * + *
+   * CLDR region code of the countries/regions the URI poses a threat ordered
+   * from most impact to least impact. Example: "US" for United States.
+   * 
+ * + * repeated string region_codes = 2; + * + * @return The count of regionCodes. + */ + int getRegionCodesCount(); + /** + * + * + *
+   * CLDR region code of the countries/regions the URI poses a threat ordered
+   * from most impact to least impact. Example: "US" for United States.
+   * 
+ * + * repeated string region_codes = 2; + * + * @param index The index of the element to return. + * @return The regionCodes at the given index. + */ + java.lang.String getRegionCodes(int index); + /** + * + * + *
+   * CLDR region code of the countries/regions the URI poses a threat ordered
+   * from most impact to least impact. Example: "US" for United States.
+   * 
+ * + * repeated string region_codes = 2; + * + * @param index The index of the value to return. + * @return The bytes of the regionCodes at the given index. + */ + com.google.protobuf.ByteString getRegionCodesBytes(int index); +} diff --git a/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatInfo.java b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatInfo.java new file mode 100644 index 000000000000..28c90106c0b7 --- /dev/null +++ b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatInfo.java @@ -0,0 +1,3901 @@ +/* + * 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 + * + * 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/webrisk/v1/webrisk.proto + +package com.google.webrisk.v1; + +/** + * + * + *
+ * Context about the submission including the type of abuse found on the URI and
+ * supporting details.
+ * option (google.api.message_visibility).restriction = "TRUSTED_TESTER";
+ * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.ThreatInfo} + */ +public final class ThreatInfo extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.webrisk.v1.ThreatInfo) + ThreatInfoOrBuilder { + private static final long serialVersionUID = 0L; + // Use ThreatInfo.newBuilder() to construct. + private ThreatInfo(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ThreatInfo() { + abuseType_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ThreatInfo(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ThreatInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ThreatInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.ThreatInfo.class, com.google.webrisk.v1.ThreatInfo.Builder.class); + } + + /** + * + * + *
+   * The abuse type found on the URI.
+   * 
+ * + * Protobuf enum {@code google.cloud.webrisk.v1.ThreatInfo.AbuseType} + */ + public enum AbuseType implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Default.
+     * 
+ * + * ABUSE_TYPE_UNSPECIFIED = 0; + */ + ABUSE_TYPE_UNSPECIFIED(0), + /** + * + * + *
+     * The URI contains malware.
+     * 
+ * + * MALWARE = 1; + */ + MALWARE(1), + /** + * + * + *
+     * The URI contains social engineering.
+     * 
+ * + * SOCIAL_ENGINEERING = 2; + */ + SOCIAL_ENGINEERING(2), + /** + * + * + *
+     * The URI contains unwanted software.
+     * 
+ * + * UNWANTED_SOFTWARE = 3; + */ + UNWANTED_SOFTWARE(3), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Default.
+     * 
+ * + * ABUSE_TYPE_UNSPECIFIED = 0; + */ + public static final int ABUSE_TYPE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * The URI contains malware.
+     * 
+ * + * MALWARE = 1; + */ + public static final int MALWARE_VALUE = 1; + /** + * + * + *
+     * The URI contains social engineering.
+     * 
+ * + * SOCIAL_ENGINEERING = 2; + */ + public static final int SOCIAL_ENGINEERING_VALUE = 2; + /** + * + * + *
+     * The URI contains unwanted software.
+     * 
+ * + * UNWANTED_SOFTWARE = 3; + */ + public static final int UNWANTED_SOFTWARE_VALUE = 3; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static AbuseType valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static AbuseType forNumber(int value) { + switch (value) { + case 0: + return ABUSE_TYPE_UNSPECIFIED; + case 1: + return MALWARE; + case 2: + return SOCIAL_ENGINEERING; + case 3: + return UNWANTED_SOFTWARE; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public AbuseType findValueByNumber(int number) { + return AbuseType.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.webrisk.v1.ThreatInfo.getDescriptor().getEnumTypes().get(0); + } + + private static final AbuseType[] VALUES = values(); + + public static AbuseType valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private AbuseType(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.webrisk.v1.ThreatInfo.AbuseType) + } + + public interface ConfidenceOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.webrisk.v1.ThreatInfo.Confidence) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * A decimal representation of confidence in the range of 0
+     * to 1 where 0 indicates no confidence and 1 indicates
+     * complete confidence.
+     * 
+ * + * float score = 1; + * + * @return Whether the score field is set. + */ + boolean hasScore(); + /** + * + * + *
+     * A decimal representation of confidence in the range of 0
+     * to 1 where 0 indicates no confidence and 1 indicates
+     * complete confidence.
+     * 
+ * + * float score = 1; + * + * @return The score. + */ + float getScore(); + + /** + * + * + *
+     * Enum representation of confidence.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.Confidence.ConfidenceLevel level = 2; + * + * @return Whether the level field is set. + */ + boolean hasLevel(); + /** + * + * + *
+     * Enum representation of confidence.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.Confidence.ConfidenceLevel level = 2; + * + * @return The enum numeric value on the wire for level. + */ + int getLevelValue(); + /** + * + * + *
+     * Enum representation of confidence.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.Confidence.ConfidenceLevel level = 2; + * + * @return The level. + */ + com.google.webrisk.v1.ThreatInfo.Confidence.ConfidenceLevel getLevel(); + + public com.google.webrisk.v1.ThreatInfo.Confidence.ValueCase getValueCase(); + } + /** + * + * + *
+   * Confidence that a URI is unsafe.
+   * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.ThreatInfo.Confidence} + */ + public static final class Confidence extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.webrisk.v1.ThreatInfo.Confidence) + ConfidenceOrBuilder { + private static final long serialVersionUID = 0L; + // Use Confidence.newBuilder() to construct. + private Confidence(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Confidence() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Confidence(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ThreatInfo_Confidence_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ThreatInfo_Confidence_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.ThreatInfo.Confidence.class, + com.google.webrisk.v1.ThreatInfo.Confidence.Builder.class); + } + + /** + * + * + *
+     * Enum representation of confidence.
+     * 
+ * + * Protobuf enum {@code google.cloud.webrisk.v1.ThreatInfo.Confidence.ConfidenceLevel} + */ + public enum ConfidenceLevel implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+       * Default.
+       * 
+ * + * CONFIDENCE_LEVEL_UNSPECIFIED = 0; + */ + CONFIDENCE_LEVEL_UNSPECIFIED(0), + /** + * + * + *
+       * Less than 60% confidence that the URI is unsafe.
+       * 
+ * + * LOW = 1; + */ + LOW(1), + /** + * + * + *
+       * Between 60% and 80% confidence that the URI is unsafe.
+       * 
+ * + * MEDIUM = 2; + */ + MEDIUM(2), + /** + * + * + *
+       * Greater than 80% confidence that the URI is unsafe.
+       * 
+ * + * HIGH = 3; + */ + HIGH(3), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+       * Default.
+       * 
+ * + * CONFIDENCE_LEVEL_UNSPECIFIED = 0; + */ + public static final int CONFIDENCE_LEVEL_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+       * Less than 60% confidence that the URI is unsafe.
+       * 
+ * + * LOW = 1; + */ + public static final int LOW_VALUE = 1; + /** + * + * + *
+       * Between 60% and 80% confidence that the URI is unsafe.
+       * 
+ * + * MEDIUM = 2; + */ + public static final int MEDIUM_VALUE = 2; + /** + * + * + *
+       * Greater than 80% confidence that the URI is unsafe.
+       * 
+ * + * HIGH = 3; + */ + public static final int HIGH_VALUE = 3; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static ConfidenceLevel valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static ConfidenceLevel forNumber(int value) { + switch (value) { + case 0: + return CONFIDENCE_LEVEL_UNSPECIFIED; + case 1: + return LOW; + case 2: + return MEDIUM; + case 3: + return HIGH; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public ConfidenceLevel findValueByNumber(int number) { + return ConfidenceLevel.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.webrisk.v1.ThreatInfo.Confidence.getDescriptor().getEnumTypes().get(0); + } + + private static final ConfidenceLevel[] VALUES = values(); + + public static ConfidenceLevel valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private ConfidenceLevel(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.webrisk.v1.ThreatInfo.Confidence.ConfidenceLevel) + } + + private int valueCase_ = 0; + private java.lang.Object value_; + + public enum ValueCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + SCORE(1), + LEVEL(2), + VALUE_NOT_SET(0); + private final int value; + + private ValueCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static ValueCase valueOf(int value) { + return forNumber(value); + } + + public static ValueCase forNumber(int value) { + switch (value) { + case 1: + return SCORE; + case 2: + return LEVEL; + case 0: + return VALUE_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public ValueCase getValueCase() { + return ValueCase.forNumber(valueCase_); + } + + public static final int SCORE_FIELD_NUMBER = 1; + /** + * + * + *
+     * A decimal representation of confidence in the range of 0
+     * to 1 where 0 indicates no confidence and 1 indicates
+     * complete confidence.
+     * 
+ * + * float score = 1; + * + * @return Whether the score field is set. + */ + @java.lang.Override + public boolean hasScore() { + return valueCase_ == 1; + } + /** + * + * + *
+     * A decimal representation of confidence in the range of 0
+     * to 1 where 0 indicates no confidence and 1 indicates
+     * complete confidence.
+     * 
+ * + * float score = 1; + * + * @return The score. + */ + @java.lang.Override + public float getScore() { + if (valueCase_ == 1) { + return (java.lang.Float) value_; + } + return 0F; + } + + public static final int LEVEL_FIELD_NUMBER = 2; + /** + * + * + *
+     * Enum representation of confidence.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.Confidence.ConfidenceLevel level = 2; + * + * @return Whether the level field is set. + */ + public boolean hasLevel() { + return valueCase_ == 2; + } + /** + * + * + *
+     * Enum representation of confidence.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.Confidence.ConfidenceLevel level = 2; + * + * @return The enum numeric value on the wire for level. + */ + public int getLevelValue() { + if (valueCase_ == 2) { + return (java.lang.Integer) value_; + } + return 0; + } + /** + * + * + *
+     * Enum representation of confidence.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.Confidence.ConfidenceLevel level = 2; + * + * @return The level. + */ + public com.google.webrisk.v1.ThreatInfo.Confidence.ConfidenceLevel getLevel() { + if (valueCase_ == 2) { + com.google.webrisk.v1.ThreatInfo.Confidence.ConfidenceLevel result = + com.google.webrisk.v1.ThreatInfo.Confidence.ConfidenceLevel.forNumber( + (java.lang.Integer) value_); + return result == null + ? com.google.webrisk.v1.ThreatInfo.Confidence.ConfidenceLevel.UNRECOGNIZED + : result; + } + return com.google.webrisk.v1.ThreatInfo.Confidence.ConfidenceLevel + .CONFIDENCE_LEVEL_UNSPECIFIED; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (valueCase_ == 1) { + output.writeFloat(1, (float) ((java.lang.Float) value_)); + } + if (valueCase_ == 2) { + output.writeEnum(2, ((java.lang.Integer) value_)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (valueCase_ == 1) { + size += + com.google.protobuf.CodedOutputStream.computeFloatSize( + 1, (float) ((java.lang.Float) value_)); + } + if (valueCase_ == 2) { + size += + com.google.protobuf.CodedOutputStream.computeEnumSize(2, ((java.lang.Integer) value_)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.webrisk.v1.ThreatInfo.Confidence)) { + return super.equals(obj); + } + com.google.webrisk.v1.ThreatInfo.Confidence other = + (com.google.webrisk.v1.ThreatInfo.Confidence) obj; + + if (!getValueCase().equals(other.getValueCase())) return false; + switch (valueCase_) { + case 1: + if (java.lang.Float.floatToIntBits(getScore()) + != java.lang.Float.floatToIntBits(other.getScore())) return false; + break; + case 2: + if (getLevelValue() != other.getLevelValue()) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + switch (valueCase_) { + case 1: + hash = (37 * hash) + SCORE_FIELD_NUMBER; + hash = (53 * hash) + java.lang.Float.floatToIntBits(getScore()); + break; + case 2: + hash = (37 * hash) + LEVEL_FIELD_NUMBER; + hash = (53 * hash) + getLevelValue(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.webrisk.v1.ThreatInfo.Confidence parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.ThreatInfo.Confidence parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.ThreatInfo.Confidence parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.ThreatInfo.Confidence parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.ThreatInfo.Confidence parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.ThreatInfo.Confidence parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.ThreatInfo.Confidence parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.ThreatInfo.Confidence parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.webrisk.v1.ThreatInfo.Confidence parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.ThreatInfo.Confidence parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.webrisk.v1.ThreatInfo.Confidence parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.ThreatInfo.Confidence parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.webrisk.v1.ThreatInfo.Confidence prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * Confidence that a URI is unsafe.
+     * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.ThreatInfo.Confidence} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.webrisk.v1.ThreatInfo.Confidence) + com.google.webrisk.v1.ThreatInfo.ConfidenceOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ThreatInfo_Confidence_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ThreatInfo_Confidence_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.ThreatInfo.Confidence.class, + com.google.webrisk.v1.ThreatInfo.Confidence.Builder.class); + } + + // Construct using com.google.webrisk.v1.ThreatInfo.Confidence.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + valueCase_ = 0; + value_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ThreatInfo_Confidence_descriptor; + } + + @java.lang.Override + public com.google.webrisk.v1.ThreatInfo.Confidence getDefaultInstanceForType() { + return com.google.webrisk.v1.ThreatInfo.Confidence.getDefaultInstance(); + } + + @java.lang.Override + public com.google.webrisk.v1.ThreatInfo.Confidence build() { + com.google.webrisk.v1.ThreatInfo.Confidence result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.webrisk.v1.ThreatInfo.Confidence buildPartial() { + com.google.webrisk.v1.ThreatInfo.Confidence result = + new com.google.webrisk.v1.ThreatInfo.Confidence(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0(com.google.webrisk.v1.ThreatInfo.Confidence result) { + int from_bitField0_ = bitField0_; + } + + private void buildPartialOneofs(com.google.webrisk.v1.ThreatInfo.Confidence result) { + result.valueCase_ = valueCase_; + result.value_ = this.value_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.webrisk.v1.ThreatInfo.Confidence) { + return mergeFrom((com.google.webrisk.v1.ThreatInfo.Confidence) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.webrisk.v1.ThreatInfo.Confidence other) { + if (other == com.google.webrisk.v1.ThreatInfo.Confidence.getDefaultInstance()) return this; + switch (other.getValueCase()) { + case SCORE: + { + setScore(other.getScore()); + break; + } + case LEVEL: + { + setLevelValue(other.getLevelValue()); + break; + } + case VALUE_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 13: + { + value_ = input.readFloat(); + valueCase_ = 1; + break; + } // case 13 + case 16: + { + int rawValue = input.readEnum(); + valueCase_ = 2; + value_ = rawValue; + break; + } // case 16 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int valueCase_ = 0; + private java.lang.Object value_; + + public ValueCase getValueCase() { + return ValueCase.forNumber(valueCase_); + } + + public Builder clearValue() { + valueCase_ = 0; + value_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + /** + * + * + *
+       * A decimal representation of confidence in the range of 0
+       * to 1 where 0 indicates no confidence and 1 indicates
+       * complete confidence.
+       * 
+ * + * float score = 1; + * + * @return Whether the score field is set. + */ + public boolean hasScore() { + return valueCase_ == 1; + } + /** + * + * + *
+       * A decimal representation of confidence in the range of 0
+       * to 1 where 0 indicates no confidence and 1 indicates
+       * complete confidence.
+       * 
+ * + * float score = 1; + * + * @return The score. + */ + public float getScore() { + if (valueCase_ == 1) { + return (java.lang.Float) value_; + } + return 0F; + } + /** + * + * + *
+       * A decimal representation of confidence in the range of 0
+       * to 1 where 0 indicates no confidence and 1 indicates
+       * complete confidence.
+       * 
+ * + * float score = 1; + * + * @param value The score to set. + * @return This builder for chaining. + */ + public Builder setScore(float value) { + + valueCase_ = 1; + value_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * A decimal representation of confidence in the range of 0
+       * to 1 where 0 indicates no confidence and 1 indicates
+       * complete confidence.
+       * 
+ * + * float score = 1; + * + * @return This builder for chaining. + */ + public Builder clearScore() { + if (valueCase_ == 1) { + valueCase_ = 0; + value_ = null; + onChanged(); + } + return this; + } + + /** + * + * + *
+       * Enum representation of confidence.
+       * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.Confidence.ConfidenceLevel level = 2; + * + * @return Whether the level field is set. + */ + @java.lang.Override + public boolean hasLevel() { + return valueCase_ == 2; + } + /** + * + * + *
+       * Enum representation of confidence.
+       * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.Confidence.ConfidenceLevel level = 2; + * + * @return The enum numeric value on the wire for level. + */ + @java.lang.Override + public int getLevelValue() { + if (valueCase_ == 2) { + return ((java.lang.Integer) value_).intValue(); + } + return 0; + } + /** + * + * + *
+       * Enum representation of confidence.
+       * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.Confidence.ConfidenceLevel level = 2; + * + * @param value The enum numeric value on the wire for level to set. + * @return This builder for chaining. + */ + public Builder setLevelValue(int value) { + valueCase_ = 2; + value_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * Enum representation of confidence.
+       * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.Confidence.ConfidenceLevel level = 2; + * + * @return The level. + */ + @java.lang.Override + public com.google.webrisk.v1.ThreatInfo.Confidence.ConfidenceLevel getLevel() { + if (valueCase_ == 2) { + com.google.webrisk.v1.ThreatInfo.Confidence.ConfidenceLevel result = + com.google.webrisk.v1.ThreatInfo.Confidence.ConfidenceLevel.forNumber( + (java.lang.Integer) value_); + return result == null + ? com.google.webrisk.v1.ThreatInfo.Confidence.ConfidenceLevel.UNRECOGNIZED + : result; + } + return com.google.webrisk.v1.ThreatInfo.Confidence.ConfidenceLevel + .CONFIDENCE_LEVEL_UNSPECIFIED; + } + /** + * + * + *
+       * Enum representation of confidence.
+       * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.Confidence.ConfidenceLevel level = 2; + * + * @param value The level to set. + * @return This builder for chaining. + */ + public Builder setLevel(com.google.webrisk.v1.ThreatInfo.Confidence.ConfidenceLevel value) { + if (value == null) { + throw new NullPointerException(); + } + valueCase_ = 2; + value_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+       * Enum representation of confidence.
+       * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.Confidence.ConfidenceLevel level = 2; + * + * @return This builder for chaining. + */ + public Builder clearLevel() { + if (valueCase_ == 2) { + valueCase_ = 0; + value_ = null; + onChanged(); + } + return this; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.webrisk.v1.ThreatInfo.Confidence) + } + + // @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.ThreatInfo.Confidence) + private static final com.google.webrisk.v1.ThreatInfo.Confidence DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.webrisk.v1.ThreatInfo.Confidence(); + } + + public static com.google.webrisk.v1.ThreatInfo.Confidence getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Confidence parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.webrisk.v1.ThreatInfo.Confidence getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface ThreatJustificationOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.webrisk.v1.ThreatInfo.ThreatJustification) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * Labels associated with this URI that explain how it was classified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel labels = 1; + * + * + * @return A list containing the labels. + */ + java.util.List + getLabelsList(); + /** + * + * + *
+     * Labels associated with this URI that explain how it was classified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel labels = 1; + * + * + * @return The count of labels. + */ + int getLabelsCount(); + /** + * + * + *
+     * Labels associated with this URI that explain how it was classified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel labels = 1; + * + * + * @param index The index of the element to return. + * @return The labels at the given index. + */ + com.google.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel getLabels(int index); + /** + * + * + *
+     * Labels associated with this URI that explain how it was classified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel labels = 1; + * + * + * @return A list containing the enum numeric values on the wire for labels. + */ + java.util.List getLabelsValueList(); + /** + * + * + *
+     * Labels associated with this URI that explain how it was classified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel labels = 1; + * + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of labels at the given index. + */ + int getLabelsValue(int index); + + /** + * + * + *
+     * Free-form context on why this URI is unsafe.
+     * 
+ * + * repeated string comments = 2; + * + * @return A list containing the comments. + */ + java.util.List getCommentsList(); + /** + * + * + *
+     * Free-form context on why this URI is unsafe.
+     * 
+ * + * repeated string comments = 2; + * + * @return The count of comments. + */ + int getCommentsCount(); + /** + * + * + *
+     * Free-form context on why this URI is unsafe.
+     * 
+ * + * repeated string comments = 2; + * + * @param index The index of the element to return. + * @return The comments at the given index. + */ + java.lang.String getComments(int index); + /** + * + * + *
+     * Free-form context on why this URI is unsafe.
+     * 
+ * + * repeated string comments = 2; + * + * @param index The index of the value to return. + * @return The bytes of the comments at the given index. + */ + com.google.protobuf.ByteString getCommentsBytes(int index); + } + /** + * + * + *
+   * Context about why the URI is unsafe.
+   * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.ThreatInfo.ThreatJustification} + */ + public static final class ThreatJustification extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.webrisk.v1.ThreatInfo.ThreatJustification) + ThreatJustificationOrBuilder { + private static final long serialVersionUID = 0L; + // Use ThreatJustification.newBuilder() to construct. + private ThreatJustification(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ThreatJustification() { + labels_ = java.util.Collections.emptyList(); + comments_ = com.google.protobuf.LazyStringArrayList.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ThreatJustification(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ThreatInfo_ThreatJustification_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ThreatInfo_ThreatJustification_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.ThreatInfo.ThreatJustification.class, + com.google.webrisk.v1.ThreatInfo.ThreatJustification.Builder.class); + } + + /** + * + * + *
+     * Labels that explain how the URI was classified.
+     * 
+ * + * Protobuf enum {@code + * google.cloud.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel} + */ + public enum JustificationLabel implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+       * Default.
+       * 
+ * + * JUSTIFICATION_LABEL_UNSPECIFIED = 0; + */ + JUSTIFICATION_LABEL_UNSPECIFIED(0), + /** + * + * + *
+       * The submitter manually verified that the submission is unsafe.
+       * 
+ * + * MANUAL_VERIFICATION = 1; + */ + MANUAL_VERIFICATION(1), + /** + * + * + *
+       * The submitter received the submission from an end user.
+       * 
+ * + * USER_REPORT = 2; + */ + USER_REPORT(2), + /** + * + * + *
+       * The submitter received the submission from an automated system.
+       * 
+ * + * AUTOMATED_REPORT = 3; + */ + AUTOMATED_REPORT(3), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+       * Default.
+       * 
+ * + * JUSTIFICATION_LABEL_UNSPECIFIED = 0; + */ + public static final int JUSTIFICATION_LABEL_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+       * The submitter manually verified that the submission is unsafe.
+       * 
+ * + * MANUAL_VERIFICATION = 1; + */ + public static final int MANUAL_VERIFICATION_VALUE = 1; + /** + * + * + *
+       * The submitter received the submission from an end user.
+       * 
+ * + * USER_REPORT = 2; + */ + public static final int USER_REPORT_VALUE = 2; + /** + * + * + *
+       * The submitter received the submission from an automated system.
+       * 
+ * + * AUTOMATED_REPORT = 3; + */ + public static final int AUTOMATED_REPORT_VALUE = 3; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static JustificationLabel valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static JustificationLabel forNumber(int value) { + switch (value) { + case 0: + return JUSTIFICATION_LABEL_UNSPECIFIED; + case 1: + return MANUAL_VERIFICATION; + case 2: + return USER_REPORT; + case 3: + return AUTOMATED_REPORT; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public JustificationLabel findValueByNumber(int number) { + return JustificationLabel.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.webrisk.v1.ThreatInfo.ThreatJustification.getDescriptor() + .getEnumTypes() + .get(0); + } + + private static final JustificationLabel[] VALUES = values(); + + public static JustificationLabel valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private JustificationLabel(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel) + } + + public static final int LABELS_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private java.util.List labels_; + + private static final com.google.protobuf.Internal.ListAdapter.Converter< + java.lang.Integer, + com.google.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel> + labels_converter_ = + new com.google.protobuf.Internal.ListAdapter.Converter< + java.lang.Integer, + com.google.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel>() { + public com.google.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel + convert(java.lang.Integer from) { + com.google.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel result = + com.google.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel + .forNumber(from); + return result == null + ? com.google.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel + .UNRECOGNIZED + : result; + } + }; + /** + * + * + *
+     * Labels associated with this URI that explain how it was classified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel labels = 1; + * + * + * @return A list containing the labels. + */ + @java.lang.Override + public java.util.List + getLabelsList() { + return new com.google.protobuf.Internal.ListAdapter< + java.lang.Integer, + com.google.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel>( + labels_, labels_converter_); + } + /** + * + * + *
+     * Labels associated with this URI that explain how it was classified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel labels = 1; + * + * + * @return The count of labels. + */ + @java.lang.Override + public int getLabelsCount() { + return labels_.size(); + } + /** + * + * + *
+     * Labels associated with this URI that explain how it was classified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel labels = 1; + * + * + * @param index The index of the element to return. + * @return The labels at the given index. + */ + @java.lang.Override + public com.google.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel getLabels( + int index) { + return labels_converter_.convert(labels_.get(index)); + } + /** + * + * + *
+     * Labels associated with this URI that explain how it was classified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel labels = 1; + * + * + * @return A list containing the enum numeric values on the wire for labels. + */ + @java.lang.Override + public java.util.List getLabelsValueList() { + return labels_; + } + /** + * + * + *
+     * Labels associated with this URI that explain how it was classified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel labels = 1; + * + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of labels at the given index. + */ + @java.lang.Override + public int getLabelsValue(int index) { + return labels_.get(index); + } + + private int labelsMemoizedSerializedSize; + + public static final int COMMENTS_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringList comments_; + /** + * + * + *
+     * Free-form context on why this URI is unsafe.
+     * 
+ * + * repeated string comments = 2; + * + * @return A list containing the comments. + */ + public com.google.protobuf.ProtocolStringList getCommentsList() { + return comments_; + } + /** + * + * + *
+     * Free-form context on why this URI is unsafe.
+     * 
+ * + * repeated string comments = 2; + * + * @return The count of comments. + */ + public int getCommentsCount() { + return comments_.size(); + } + /** + * + * + *
+     * Free-form context on why this URI is unsafe.
+     * 
+ * + * repeated string comments = 2; + * + * @param index The index of the element to return. + * @return The comments at the given index. + */ + public java.lang.String getComments(int index) { + return comments_.get(index); + } + /** + * + * + *
+     * Free-form context on why this URI is unsafe.
+     * 
+ * + * repeated string comments = 2; + * + * @param index The index of the value to return. + * @return The bytes of the comments at the given index. + */ + public com.google.protobuf.ByteString getCommentsBytes(int index) { + return comments_.getByteString(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + getSerializedSize(); + if (getLabelsList().size() > 0) { + output.writeUInt32NoTag(10); + output.writeUInt32NoTag(labelsMemoizedSerializedSize); + } + for (int i = 0; i < labels_.size(); i++) { + output.writeEnumNoTag(labels_.get(i)); + } + for (int i = 0; i < comments_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, comments_.getRaw(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + for (int i = 0; i < labels_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream.computeEnumSizeNoTag(labels_.get(i)); + } + size += dataSize; + if (!getLabelsList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(dataSize); + } + labelsMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + for (int i = 0; i < comments_.size(); i++) { + dataSize += computeStringSizeNoTag(comments_.getRaw(i)); + } + size += dataSize; + size += 1 * getCommentsList().size(); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.webrisk.v1.ThreatInfo.ThreatJustification)) { + return super.equals(obj); + } + com.google.webrisk.v1.ThreatInfo.ThreatJustification other = + (com.google.webrisk.v1.ThreatInfo.ThreatJustification) obj; + + if (!labels_.equals(other.labels_)) return false; + if (!getCommentsList().equals(other.getCommentsList())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getLabelsCount() > 0) { + hash = (37 * hash) + LABELS_FIELD_NUMBER; + hash = (53 * hash) + labels_.hashCode(); + } + if (getCommentsCount() > 0) { + hash = (37 * hash) + COMMENTS_FIELD_NUMBER; + hash = (53 * hash) + getCommentsList().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.webrisk.v1.ThreatInfo.ThreatJustification parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.ThreatInfo.ThreatJustification parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.ThreatInfo.ThreatJustification parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.ThreatInfo.ThreatJustification parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.ThreatInfo.ThreatJustification parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.ThreatInfo.ThreatJustification parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.ThreatInfo.ThreatJustification parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.ThreatInfo.ThreatJustification parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.webrisk.v1.ThreatInfo.ThreatJustification parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.ThreatInfo.ThreatJustification parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.webrisk.v1.ThreatInfo.ThreatJustification parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.ThreatInfo.ThreatJustification parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.webrisk.v1.ThreatInfo.ThreatJustification prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * Context about why the URI is unsafe.
+     * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.ThreatInfo.ThreatJustification} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.webrisk.v1.ThreatInfo.ThreatJustification) + com.google.webrisk.v1.ThreatInfo.ThreatJustificationOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ThreatInfo_ThreatJustification_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ThreatInfo_ThreatJustification_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.ThreatInfo.ThreatJustification.class, + com.google.webrisk.v1.ThreatInfo.ThreatJustification.Builder.class); + } + + // Construct using com.google.webrisk.v1.ThreatInfo.ThreatJustification.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + labels_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + comments_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ThreatInfo_ThreatJustification_descriptor; + } + + @java.lang.Override + public com.google.webrisk.v1.ThreatInfo.ThreatJustification getDefaultInstanceForType() { + return com.google.webrisk.v1.ThreatInfo.ThreatJustification.getDefaultInstance(); + } + + @java.lang.Override + public com.google.webrisk.v1.ThreatInfo.ThreatJustification build() { + com.google.webrisk.v1.ThreatInfo.ThreatJustification result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.webrisk.v1.ThreatInfo.ThreatJustification buildPartial() { + com.google.webrisk.v1.ThreatInfo.ThreatJustification result = + new com.google.webrisk.v1.ThreatInfo.ThreatJustification(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields( + com.google.webrisk.v1.ThreatInfo.ThreatJustification result) { + if (((bitField0_ & 0x00000001) != 0)) { + labels_ = java.util.Collections.unmodifiableList(labels_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.labels_ = labels_; + if (((bitField0_ & 0x00000002) != 0)) { + comments_ = comments_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.comments_ = comments_; + } + + private void buildPartial0(com.google.webrisk.v1.ThreatInfo.ThreatJustification result) { + int from_bitField0_ = bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.webrisk.v1.ThreatInfo.ThreatJustification) { + return mergeFrom((com.google.webrisk.v1.ThreatInfo.ThreatJustification) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.webrisk.v1.ThreatInfo.ThreatJustification other) { + if (other == com.google.webrisk.v1.ThreatInfo.ThreatJustification.getDefaultInstance()) + return this; + if (!other.labels_.isEmpty()) { + if (labels_.isEmpty()) { + labels_ = other.labels_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureLabelsIsMutable(); + labels_.addAll(other.labels_); + } + onChanged(); + } + if (!other.comments_.isEmpty()) { + if (comments_.isEmpty()) { + comments_ = other.comments_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureCommentsIsMutable(); + comments_.addAll(other.comments_); + } + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + int tmpRaw = input.readEnum(); + ensureLabelsIsMutable(); + labels_.add(tmpRaw); + break; + } // case 8 + case 10: + { + int length = input.readRawVarint32(); + int oldLimit = input.pushLimit(length); + while (input.getBytesUntilLimit() > 0) { + int tmpRaw = input.readEnum(); + ensureLabelsIsMutable(); + labels_.add(tmpRaw); + } + input.popLimit(oldLimit); + break; + } // case 10 + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + ensureCommentsIsMutable(); + comments_.add(s); + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.util.List labels_ = java.util.Collections.emptyList(); + + private void ensureLabelsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + labels_ = new java.util.ArrayList(labels_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+       * Labels associated with this URI that explain how it was classified.
+       * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel labels = 1; + * + * + * @return A list containing the labels. + */ + public java.util.List + getLabelsList() { + return new com.google.protobuf.Internal.ListAdapter< + java.lang.Integer, + com.google.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel>( + labels_, labels_converter_); + } + /** + * + * + *
+       * Labels associated with this URI that explain how it was classified.
+       * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel labels = 1; + * + * + * @return The count of labels. + */ + public int getLabelsCount() { + return labels_.size(); + } + /** + * + * + *
+       * Labels associated with this URI that explain how it was classified.
+       * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel labels = 1; + * + * + * @param index The index of the element to return. + * @return The labels at the given index. + */ + public com.google.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel getLabels( + int index) { + return labels_converter_.convert(labels_.get(index)); + } + /** + * + * + *
+       * Labels associated with this URI that explain how it was classified.
+       * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel labels = 1; + * + * + * @param index The index to set the value at. + * @param value The labels to set. + * @return This builder for chaining. + */ + public Builder setLabels( + int index, + com.google.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel value) { + if (value == null) { + throw new NullPointerException(); + } + ensureLabelsIsMutable(); + labels_.set(index, value.getNumber()); + onChanged(); + return this; + } + /** + * + * + *
+       * Labels associated with this URI that explain how it was classified.
+       * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel labels = 1; + * + * + * @param value The labels to add. + * @return This builder for chaining. + */ + public Builder addLabels( + com.google.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel value) { + if (value == null) { + throw new NullPointerException(); + } + ensureLabelsIsMutable(); + labels_.add(value.getNumber()); + onChanged(); + return this; + } + /** + * + * + *
+       * Labels associated with this URI that explain how it was classified.
+       * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel labels = 1; + * + * + * @param values The labels to add. + * @return This builder for chaining. + */ + public Builder addAllLabels( + java.lang.Iterable< + ? extends com.google.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel> + values) { + ensureLabelsIsMutable(); + for (com.google.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel value : + values) { + labels_.add(value.getNumber()); + } + onChanged(); + return this; + } + /** + * + * + *
+       * Labels associated with this URI that explain how it was classified.
+       * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel labels = 1; + * + * + * @return This builder for chaining. + */ + public Builder clearLabels() { + labels_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+       * Labels associated with this URI that explain how it was classified.
+       * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel labels = 1; + * + * + * @return A list containing the enum numeric values on the wire for labels. + */ + public java.util.List getLabelsValueList() { + return java.util.Collections.unmodifiableList(labels_); + } + /** + * + * + *
+       * Labels associated with this URI that explain how it was classified.
+       * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel labels = 1; + * + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of labels at the given index. + */ + public int getLabelsValue(int index) { + return labels_.get(index); + } + /** + * + * + *
+       * Labels associated with this URI that explain how it was classified.
+       * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel labels = 1; + * + * + * @param index The index to set the value at. + * @param value The enum numeric value on the wire for labels to set. + * @return This builder for chaining. + */ + public Builder setLabelsValue(int index, int value) { + ensureLabelsIsMutable(); + labels_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+       * Labels associated with this URI that explain how it was classified.
+       * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel labels = 1; + * + * + * @param value The enum numeric value on the wire for labels to add. + * @return This builder for chaining. + */ + public Builder addLabelsValue(int value) { + ensureLabelsIsMutable(); + labels_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+       * Labels associated with this URI that explain how it was classified.
+       * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel labels = 1; + * + * + * @param values The enum numeric values on the wire for labels to add. + * @return This builder for chaining. + */ + public Builder addAllLabelsValue(java.lang.Iterable values) { + ensureLabelsIsMutable(); + for (int value : values) { + labels_.add(value); + } + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList comments_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureCommentsIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + comments_ = new com.google.protobuf.LazyStringArrayList(comments_); + bitField0_ |= 0x00000002; + } + } + /** + * + * + *
+       * Free-form context on why this URI is unsafe.
+       * 
+ * + * repeated string comments = 2; + * + * @return A list containing the comments. + */ + public com.google.protobuf.ProtocolStringList getCommentsList() { + return comments_.getUnmodifiableView(); + } + /** + * + * + *
+       * Free-form context on why this URI is unsafe.
+       * 
+ * + * repeated string comments = 2; + * + * @return The count of comments. + */ + public int getCommentsCount() { + return comments_.size(); + } + /** + * + * + *
+       * Free-form context on why this URI is unsafe.
+       * 
+ * + * repeated string comments = 2; + * + * @param index The index of the element to return. + * @return The comments at the given index. + */ + public java.lang.String getComments(int index) { + return comments_.get(index); + } + /** + * + * + *
+       * Free-form context on why this URI is unsafe.
+       * 
+ * + * repeated string comments = 2; + * + * @param index The index of the value to return. + * @return The bytes of the comments at the given index. + */ + public com.google.protobuf.ByteString getCommentsBytes(int index) { + return comments_.getByteString(index); + } + /** + * + * + *
+       * Free-form context on why this URI is unsafe.
+       * 
+ * + * repeated string comments = 2; + * + * @param index The index to set the value at. + * @param value The comments to set. + * @return This builder for chaining. + */ + public Builder setComments(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureCommentsIsMutable(); + comments_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+       * Free-form context on why this URI is unsafe.
+       * 
+ * + * repeated string comments = 2; + * + * @param value The comments to add. + * @return This builder for chaining. + */ + public Builder addComments(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureCommentsIsMutable(); + comments_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+       * Free-form context on why this URI is unsafe.
+       * 
+ * + * repeated string comments = 2; + * + * @param values The comments to add. + * @return This builder for chaining. + */ + public Builder addAllComments(java.lang.Iterable values) { + ensureCommentsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, comments_); + onChanged(); + return this; + } + /** + * + * + *
+       * Free-form context on why this URI is unsafe.
+       * 
+ * + * repeated string comments = 2; + * + * @return This builder for chaining. + */ + public Builder clearComments() { + comments_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+       * Free-form context on why this URI is unsafe.
+       * 
+ * + * repeated string comments = 2; + * + * @param value The bytes of the comments to add. + * @return This builder for chaining. + */ + public Builder addCommentsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureCommentsIsMutable(); + comments_.add(value); + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.webrisk.v1.ThreatInfo.ThreatJustification) + } + + // @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.ThreatInfo.ThreatJustification) + private static final com.google.webrisk.v1.ThreatInfo.ThreatJustification DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.webrisk.v1.ThreatInfo.ThreatJustification(); + } + + public static com.google.webrisk.v1.ThreatInfo.ThreatJustification getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ThreatJustification parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.webrisk.v1.ThreatInfo.ThreatJustification getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public static final int ABUSE_TYPE_FIELD_NUMBER = 1; + private int abuseType_ = 0; + /** + * + * + *
+   * The type of abuse.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.AbuseType abuse_type = 1; + * + * @return The enum numeric value on the wire for abuseType. + */ + @java.lang.Override + public int getAbuseTypeValue() { + return abuseType_; + } + /** + * + * + *
+   * The type of abuse.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.AbuseType abuse_type = 1; + * + * @return The abuseType. + */ + @java.lang.Override + public com.google.webrisk.v1.ThreatInfo.AbuseType getAbuseType() { + com.google.webrisk.v1.ThreatInfo.AbuseType result = + com.google.webrisk.v1.ThreatInfo.AbuseType.forNumber(abuseType_); + return result == null ? com.google.webrisk.v1.ThreatInfo.AbuseType.UNRECOGNIZED : result; + } + + public static final int THREAT_CONFIDENCE_FIELD_NUMBER = 2; + private com.google.webrisk.v1.ThreatInfo.Confidence threatConfidence_; + /** + * + * + *
+   * Confidence that the URI is unsafe.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.Confidence threat_confidence = 2; + * + * @return Whether the threatConfidence field is set. + */ + @java.lang.Override + public boolean hasThreatConfidence() { + return threatConfidence_ != null; + } + /** + * + * + *
+   * Confidence that the URI is unsafe.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.Confidence threat_confidence = 2; + * + * @return The threatConfidence. + */ + @java.lang.Override + public com.google.webrisk.v1.ThreatInfo.Confidence getThreatConfidence() { + return threatConfidence_ == null + ? com.google.webrisk.v1.ThreatInfo.Confidence.getDefaultInstance() + : threatConfidence_; + } + /** + * + * + *
+   * Confidence that the URI is unsafe.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.Confidence threat_confidence = 2; + */ + @java.lang.Override + public com.google.webrisk.v1.ThreatInfo.ConfidenceOrBuilder getThreatConfidenceOrBuilder() { + return threatConfidence_ == null + ? com.google.webrisk.v1.ThreatInfo.Confidence.getDefaultInstance() + : threatConfidence_; + } + + public static final int THREAT_JUSTIFICATION_FIELD_NUMBER = 3; + private com.google.webrisk.v1.ThreatInfo.ThreatJustification threatJustification_; + /** + * + * + *
+   * Context about why the URI is unsafe.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification threat_justification = 3; + * + * @return Whether the threatJustification field is set. + */ + @java.lang.Override + public boolean hasThreatJustification() { + return threatJustification_ != null; + } + /** + * + * + *
+   * Context about why the URI is unsafe.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification threat_justification = 3; + * + * @return The threatJustification. + */ + @java.lang.Override + public com.google.webrisk.v1.ThreatInfo.ThreatJustification getThreatJustification() { + return threatJustification_ == null + ? com.google.webrisk.v1.ThreatInfo.ThreatJustification.getDefaultInstance() + : threatJustification_; + } + /** + * + * + *
+   * Context about why the URI is unsafe.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification threat_justification = 3; + */ + @java.lang.Override + public com.google.webrisk.v1.ThreatInfo.ThreatJustificationOrBuilder + getThreatJustificationOrBuilder() { + return threatJustification_ == null + ? com.google.webrisk.v1.ThreatInfo.ThreatJustification.getDefaultInstance() + : threatJustification_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (abuseType_ + != com.google.webrisk.v1.ThreatInfo.AbuseType.ABUSE_TYPE_UNSPECIFIED.getNumber()) { + output.writeEnum(1, abuseType_); + } + if (threatConfidence_ != null) { + output.writeMessage(2, getThreatConfidence()); + } + if (threatJustification_ != null) { + output.writeMessage(3, getThreatJustification()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (abuseType_ + != com.google.webrisk.v1.ThreatInfo.AbuseType.ABUSE_TYPE_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, abuseType_); + } + if (threatConfidence_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getThreatConfidence()); + } + if (threatJustification_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getThreatJustification()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.webrisk.v1.ThreatInfo)) { + return super.equals(obj); + } + com.google.webrisk.v1.ThreatInfo other = (com.google.webrisk.v1.ThreatInfo) obj; + + if (abuseType_ != other.abuseType_) return false; + if (hasThreatConfidence() != other.hasThreatConfidence()) return false; + if (hasThreatConfidence()) { + if (!getThreatConfidence().equals(other.getThreatConfidence())) return false; + } + if (hasThreatJustification() != other.hasThreatJustification()) return false; + if (hasThreatJustification()) { + if (!getThreatJustification().equals(other.getThreatJustification())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + ABUSE_TYPE_FIELD_NUMBER; + hash = (53 * hash) + abuseType_; + if (hasThreatConfidence()) { + hash = (37 * hash) + THREAT_CONFIDENCE_FIELD_NUMBER; + hash = (53 * hash) + getThreatConfidence().hashCode(); + } + if (hasThreatJustification()) { + hash = (37 * hash) + THREAT_JUSTIFICATION_FIELD_NUMBER; + hash = (53 * hash) + getThreatJustification().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.webrisk.v1.ThreatInfo parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.ThreatInfo parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.ThreatInfo parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.ThreatInfo parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.ThreatInfo parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.ThreatInfo parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.ThreatInfo parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.ThreatInfo parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.webrisk.v1.ThreatInfo parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.ThreatInfo parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.webrisk.v1.ThreatInfo parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.ThreatInfo parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.webrisk.v1.ThreatInfo prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Context about the submission including the type of abuse found on the URI and
+   * supporting details.
+   * option (google.api.message_visibility).restriction = "TRUSTED_TESTER";
+   * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.ThreatInfo} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.webrisk.v1.ThreatInfo) + com.google.webrisk.v1.ThreatInfoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ThreatInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ThreatInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.ThreatInfo.class, + com.google.webrisk.v1.ThreatInfo.Builder.class); + } + + // Construct using com.google.webrisk.v1.ThreatInfo.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + abuseType_ = 0; + threatConfidence_ = null; + if (threatConfidenceBuilder_ != null) { + threatConfidenceBuilder_.dispose(); + threatConfidenceBuilder_ = null; + } + threatJustification_ = null; + if (threatJustificationBuilder_ != null) { + threatJustificationBuilder_.dispose(); + threatJustificationBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ThreatInfo_descriptor; + } + + @java.lang.Override + public com.google.webrisk.v1.ThreatInfo getDefaultInstanceForType() { + return com.google.webrisk.v1.ThreatInfo.getDefaultInstance(); + } + + @java.lang.Override + public com.google.webrisk.v1.ThreatInfo build() { + com.google.webrisk.v1.ThreatInfo result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.webrisk.v1.ThreatInfo buildPartial() { + com.google.webrisk.v1.ThreatInfo result = new com.google.webrisk.v1.ThreatInfo(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.webrisk.v1.ThreatInfo result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.abuseType_ = abuseType_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.threatConfidence_ = + threatConfidenceBuilder_ == null ? threatConfidence_ : threatConfidenceBuilder_.build(); + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.threatJustification_ = + threatJustificationBuilder_ == null + ? threatJustification_ + : threatJustificationBuilder_.build(); + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.webrisk.v1.ThreatInfo) { + return mergeFrom((com.google.webrisk.v1.ThreatInfo) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.webrisk.v1.ThreatInfo other) { + if (other == com.google.webrisk.v1.ThreatInfo.getDefaultInstance()) return this; + if (other.abuseType_ != 0) { + setAbuseTypeValue(other.getAbuseTypeValue()); + } + if (other.hasThreatConfidence()) { + mergeThreatConfidence(other.getThreatConfidence()); + } + if (other.hasThreatJustification()) { + mergeThreatJustification(other.getThreatJustification()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + abuseType_ = input.readEnum(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 18: + { + input.readMessage( + getThreatConfidenceFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + input.readMessage( + getThreatJustificationFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private int abuseType_ = 0; + /** + * + * + *
+     * The type of abuse.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.AbuseType abuse_type = 1; + * + * @return The enum numeric value on the wire for abuseType. + */ + @java.lang.Override + public int getAbuseTypeValue() { + return abuseType_; + } + /** + * + * + *
+     * The type of abuse.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.AbuseType abuse_type = 1; + * + * @param value The enum numeric value on the wire for abuseType to set. + * @return This builder for chaining. + */ + public Builder setAbuseTypeValue(int value) { + abuseType_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * The type of abuse.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.AbuseType abuse_type = 1; + * + * @return The abuseType. + */ + @java.lang.Override + public com.google.webrisk.v1.ThreatInfo.AbuseType getAbuseType() { + com.google.webrisk.v1.ThreatInfo.AbuseType result = + com.google.webrisk.v1.ThreatInfo.AbuseType.forNumber(abuseType_); + return result == null ? com.google.webrisk.v1.ThreatInfo.AbuseType.UNRECOGNIZED : result; + } + /** + * + * + *
+     * The type of abuse.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.AbuseType abuse_type = 1; + * + * @param value The abuseType to set. + * @return This builder for chaining. + */ + public Builder setAbuseType(com.google.webrisk.v1.ThreatInfo.AbuseType value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + abuseType_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * The type of abuse.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.AbuseType abuse_type = 1; + * + * @return This builder for chaining. + */ + public Builder clearAbuseType() { + bitField0_ = (bitField0_ & ~0x00000001); + abuseType_ = 0; + onChanged(); + return this; + } + + private com.google.webrisk.v1.ThreatInfo.Confidence threatConfidence_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.ThreatInfo.Confidence, + com.google.webrisk.v1.ThreatInfo.Confidence.Builder, + com.google.webrisk.v1.ThreatInfo.ConfidenceOrBuilder> + threatConfidenceBuilder_; + /** + * + * + *
+     * Confidence that the URI is unsafe.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.Confidence threat_confidence = 2; + * + * @return Whether the threatConfidence field is set. + */ + public boolean hasThreatConfidence() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+     * Confidence that the URI is unsafe.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.Confidence threat_confidence = 2; + * + * @return The threatConfidence. + */ + public com.google.webrisk.v1.ThreatInfo.Confidence getThreatConfidence() { + if (threatConfidenceBuilder_ == null) { + return threatConfidence_ == null + ? com.google.webrisk.v1.ThreatInfo.Confidence.getDefaultInstance() + : threatConfidence_; + } else { + return threatConfidenceBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Confidence that the URI is unsafe.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.Confidence threat_confidence = 2; + */ + public Builder setThreatConfidence(com.google.webrisk.v1.ThreatInfo.Confidence value) { + if (threatConfidenceBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + threatConfidence_ = value; + } else { + threatConfidenceBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Confidence that the URI is unsafe.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.Confidence threat_confidence = 2; + */ + public Builder setThreatConfidence( + com.google.webrisk.v1.ThreatInfo.Confidence.Builder builderForValue) { + if (threatConfidenceBuilder_ == null) { + threatConfidence_ = builderForValue.build(); + } else { + threatConfidenceBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Confidence that the URI is unsafe.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.Confidence threat_confidence = 2; + */ + public Builder mergeThreatConfidence(com.google.webrisk.v1.ThreatInfo.Confidence value) { + if (threatConfidenceBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) + && threatConfidence_ != null + && threatConfidence_ + != com.google.webrisk.v1.ThreatInfo.Confidence.getDefaultInstance()) { + getThreatConfidenceBuilder().mergeFrom(value); + } else { + threatConfidence_ = value; + } + } else { + threatConfidenceBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Confidence that the URI is unsafe.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.Confidence threat_confidence = 2; + */ + public Builder clearThreatConfidence() { + bitField0_ = (bitField0_ & ~0x00000002); + threatConfidence_ = null; + if (threatConfidenceBuilder_ != null) { + threatConfidenceBuilder_.dispose(); + threatConfidenceBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Confidence that the URI is unsafe.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.Confidence threat_confidence = 2; + */ + public com.google.webrisk.v1.ThreatInfo.Confidence.Builder getThreatConfidenceBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getThreatConfidenceFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Confidence that the URI is unsafe.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.Confidence threat_confidence = 2; + */ + public com.google.webrisk.v1.ThreatInfo.ConfidenceOrBuilder getThreatConfidenceOrBuilder() { + if (threatConfidenceBuilder_ != null) { + return threatConfidenceBuilder_.getMessageOrBuilder(); + } else { + return threatConfidence_ == null + ? com.google.webrisk.v1.ThreatInfo.Confidence.getDefaultInstance() + : threatConfidence_; + } + } + /** + * + * + *
+     * Confidence that the URI is unsafe.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.Confidence threat_confidence = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.ThreatInfo.Confidence, + com.google.webrisk.v1.ThreatInfo.Confidence.Builder, + com.google.webrisk.v1.ThreatInfo.ConfidenceOrBuilder> + getThreatConfidenceFieldBuilder() { + if (threatConfidenceBuilder_ == null) { + threatConfidenceBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.ThreatInfo.Confidence, + com.google.webrisk.v1.ThreatInfo.Confidence.Builder, + com.google.webrisk.v1.ThreatInfo.ConfidenceOrBuilder>( + getThreatConfidence(), getParentForChildren(), isClean()); + threatConfidence_ = null; + } + return threatConfidenceBuilder_; + } + + private com.google.webrisk.v1.ThreatInfo.ThreatJustification threatJustification_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.ThreatInfo.ThreatJustification, + com.google.webrisk.v1.ThreatInfo.ThreatJustification.Builder, + com.google.webrisk.v1.ThreatInfo.ThreatJustificationOrBuilder> + threatJustificationBuilder_; + /** + * + * + *
+     * Context about why the URI is unsafe.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification threat_justification = 3; + * + * + * @return Whether the threatJustification field is set. + */ + public boolean hasThreatJustification() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * + * + *
+     * Context about why the URI is unsafe.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification threat_justification = 3; + * + * + * @return The threatJustification. + */ + public com.google.webrisk.v1.ThreatInfo.ThreatJustification getThreatJustification() { + if (threatJustificationBuilder_ == null) { + return threatJustification_ == null + ? com.google.webrisk.v1.ThreatInfo.ThreatJustification.getDefaultInstance() + : threatJustification_; + } else { + return threatJustificationBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Context about why the URI is unsafe.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification threat_justification = 3; + * + */ + public Builder setThreatJustification( + com.google.webrisk.v1.ThreatInfo.ThreatJustification value) { + if (threatJustificationBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + threatJustification_ = value; + } else { + threatJustificationBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Context about why the URI is unsafe.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification threat_justification = 3; + * + */ + public Builder setThreatJustification( + com.google.webrisk.v1.ThreatInfo.ThreatJustification.Builder builderForValue) { + if (threatJustificationBuilder_ == null) { + threatJustification_ = builderForValue.build(); + } else { + threatJustificationBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Context about why the URI is unsafe.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification threat_justification = 3; + * + */ + public Builder mergeThreatJustification( + com.google.webrisk.v1.ThreatInfo.ThreatJustification value) { + if (threatJustificationBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) + && threatJustification_ != null + && threatJustification_ + != com.google.webrisk.v1.ThreatInfo.ThreatJustification.getDefaultInstance()) { + getThreatJustificationBuilder().mergeFrom(value); + } else { + threatJustification_ = value; + } + } else { + threatJustificationBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Context about why the URI is unsafe.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification threat_justification = 3; + * + */ + public Builder clearThreatJustification() { + bitField0_ = (bitField0_ & ~0x00000004); + threatJustification_ = null; + if (threatJustificationBuilder_ != null) { + threatJustificationBuilder_.dispose(); + threatJustificationBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Context about why the URI is unsafe.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification threat_justification = 3; + * + */ + public com.google.webrisk.v1.ThreatInfo.ThreatJustification.Builder + getThreatJustificationBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getThreatJustificationFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Context about why the URI is unsafe.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification threat_justification = 3; + * + */ + public com.google.webrisk.v1.ThreatInfo.ThreatJustificationOrBuilder + getThreatJustificationOrBuilder() { + if (threatJustificationBuilder_ != null) { + return threatJustificationBuilder_.getMessageOrBuilder(); + } else { + return threatJustification_ == null + ? com.google.webrisk.v1.ThreatInfo.ThreatJustification.getDefaultInstance() + : threatJustification_; + } + } + /** + * + * + *
+     * Context about why the URI is unsafe.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification threat_justification = 3; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.ThreatInfo.ThreatJustification, + com.google.webrisk.v1.ThreatInfo.ThreatJustification.Builder, + com.google.webrisk.v1.ThreatInfo.ThreatJustificationOrBuilder> + getThreatJustificationFieldBuilder() { + if (threatJustificationBuilder_ == null) { + threatJustificationBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.ThreatInfo.ThreatJustification, + com.google.webrisk.v1.ThreatInfo.ThreatJustification.Builder, + com.google.webrisk.v1.ThreatInfo.ThreatJustificationOrBuilder>( + getThreatJustification(), getParentForChildren(), isClean()); + threatJustification_ = null; + } + return threatJustificationBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.webrisk.v1.ThreatInfo) + } + + // @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.ThreatInfo) + private static final com.google.webrisk.v1.ThreatInfo DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.webrisk.v1.ThreatInfo(); + } + + public static com.google.webrisk.v1.ThreatInfo getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ThreatInfo parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.webrisk.v1.ThreatInfo getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatInfoOrBuilder.java b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatInfoOrBuilder.java new file mode 100644 index 000000000000..8cf6fcd2b824 --- /dev/null +++ b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatInfoOrBuilder.java @@ -0,0 +1,120 @@ +/* + * 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 + * + * 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/webrisk/v1/webrisk.proto + +package com.google.webrisk.v1; + +public interface ThreatInfoOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.webrisk.v1.ThreatInfo) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The type of abuse.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.AbuseType abuse_type = 1; + * + * @return The enum numeric value on the wire for abuseType. + */ + int getAbuseTypeValue(); + /** + * + * + *
+   * The type of abuse.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.AbuseType abuse_type = 1; + * + * @return The abuseType. + */ + com.google.webrisk.v1.ThreatInfo.AbuseType getAbuseType(); + + /** + * + * + *
+   * Confidence that the URI is unsafe.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.Confidence threat_confidence = 2; + * + * @return Whether the threatConfidence field is set. + */ + boolean hasThreatConfidence(); + /** + * + * + *
+   * Confidence that the URI is unsafe.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.Confidence threat_confidence = 2; + * + * @return The threatConfidence. + */ + com.google.webrisk.v1.ThreatInfo.Confidence getThreatConfidence(); + /** + * + * + *
+   * Confidence that the URI is unsafe.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.Confidence threat_confidence = 2; + */ + com.google.webrisk.v1.ThreatInfo.ConfidenceOrBuilder getThreatConfidenceOrBuilder(); + + /** + * + * + *
+   * Context about why the URI is unsafe.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification threat_justification = 3; + * + * @return Whether the threatJustification field is set. + */ + boolean hasThreatJustification(); + /** + * + * + *
+   * Context about why the URI is unsafe.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification threat_justification = 3; + * + * @return The threatJustification. + */ + com.google.webrisk.v1.ThreatInfo.ThreatJustification getThreatJustification(); + /** + * + * + *
+   * Context about why the URI is unsafe.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification threat_justification = 3; + */ + com.google.webrisk.v1.ThreatInfo.ThreatJustificationOrBuilder getThreatJustificationOrBuilder(); +} diff --git a/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/WebRiskProto.java b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/WebRiskProto.java index bb8b412c4b85..7eb9fd39b71e 100644 --- a/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/WebRiskProto.java +++ b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/WebRiskProto.java @@ -91,10 +91,34 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_cloud_webrisk_v1_Submission_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_cloud_webrisk_v1_Submission_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_webrisk_v1_ThreatInfo_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_webrisk_v1_ThreatInfo_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_webrisk_v1_ThreatInfo_Confidence_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_webrisk_v1_ThreatInfo_Confidence_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_webrisk_v1_ThreatInfo_ThreatJustification_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_webrisk_v1_ThreatInfo_ThreatJustification_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_webrisk_v1_ThreatDiscovery_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_webrisk_v1_ThreatDiscovery_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_cloud_webrisk_v1_CreateSubmissionRequest_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_cloud_webrisk_v1_CreateSubmissionRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_webrisk_v1_SubmitUriRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_webrisk_v1_SubmitUriRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_webrisk_v1_SubmitUriMetadata_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_webrisk_v1_SubmitUriMetadata_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; @@ -108,95 +132,141 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\027google.cloud.webrisk.v1\032\034google/api/ann" + "otations.proto\032\027google/api/client.proto\032" + "\037google/api/field_behavior.proto\032\031google" - + "/api/resource.proto\032\037google/protobuf/tim" - + "estamp.proto\"\343\002\n\034ComputeThreatListDiffRe" - + "quest\022=\n\013threat_type\030\001 \001(\0162#.google.clou" - + "d.webrisk.v1.ThreatTypeB\003\340A\002\022\025\n\rversion_" - + "token\030\002 \001(\014\022[\n\013constraints\030\003 \001(\0132A.googl" - + "e.cloud.webrisk.v1.ComputeThreatListDiff" - + "Request.ConstraintsB\003\340A\002\032\217\001\n\013Constraints" - + "\022\030\n\020max_diff_entries\030\001 \001(\005\022\034\n\024max_databa" - + "se_entries\030\002 \001(\005\022H\n\026supported_compressio" - + "ns\030\003 \003(\0162(.google.cloud.webrisk.v1.Compr" - + "essionType\"\206\004\n\035ComputeThreatListDiffResp" - + "onse\022Z\n\rresponse_type\030\004 \001(\0162C.google.clo" - + "ud.webrisk.v1.ComputeThreatListDiffRespo" - + "nse.ResponseType\022@\n\tadditions\030\005 \001(\0132-.go" - + "ogle.cloud.webrisk.v1.ThreatEntryAdditio" - + "ns\022>\n\010removals\030\006 \001(\0132,.google.cloud.webr" - + "isk.v1.ThreatEntryRemovals\022\031\n\021new_versio" - + "n_token\030\007 \001(\014\022Q\n\010checksum\030\010 \001(\0132?.google" - + ".cloud.webrisk.v1.ComputeThreatListDiffR" - + "esponse.Checksum\0229\n\025recommended_next_dif" - + "f\030\002 \001(\0132\032.google.protobuf.Timestamp\032\032\n\010C" - + "hecksum\022\016\n\006sha256\030\001 \001(\014\"B\n\014ResponseType\022" - + "\035\n\031RESPONSE_TYPE_UNSPECIFIED\020\000\022\010\n\004DIFF\020\001" - + "\022\t\n\005RESET\020\002\"e\n\021SearchUrisRequest\022\020\n\003uri\030" - + "\001 \001(\tB\003\340A\002\022>\n\014threat_types\030\002 \003(\0162#.googl" - + "e.cloud.webrisk.v1.ThreatTypeB\003\340A\002\"\324\001\n\022S" - + "earchUrisResponse\022E\n\006threat\030\001 \001(\01325.goog" - + "le.cloud.webrisk.v1.SearchUrisResponse.T" - + "hreatUri\032w\n\tThreatUri\0229\n\014threat_types\030\001 " - + "\003(\0162#.google.cloud.webrisk.v1.ThreatType" - + "\022/\n\013expire_time\030\002 \001(\0132\032.google.protobuf." - + "Timestamp\"j\n\023SearchHashesRequest\022\023\n\013hash" - + "_prefix\030\001 \001(\014\022>\n\014threat_types\030\002 \003(\0162#.go" - + "ogle.cloud.webrisk.v1.ThreatTypeB\003\340A\002\"\244\002" - + "\n\024SearchHashesResponse\022I\n\007threats\030\001 \003(\0132" - + "8.google.cloud.webrisk.v1.SearchHashesRe" - + "sponse.ThreatHash\0228\n\024negative_expire_tim" - + "e\030\002 \001(\0132\032.google.protobuf.Timestamp\032\206\001\n\n" - + "ThreatHash\0229\n\014threat_types\030\001 \003(\0162#.googl" - + "e.cloud.webrisk.v1.ThreatType\022\014\n\004hash\030\002 " - + "\001(\014\022/\n\013expire_time\030\003 \001(\0132\032.google.protob" - + "uf.Timestamp\"\217\001\n\024ThreatEntryAdditions\0226\n" - + "\nraw_hashes\030\001 \003(\0132\".google.cloud.webrisk" - + ".v1.RawHashes\022?\n\013rice_hashes\030\002 \001(\0132*.goo" - + "gle.cloud.webrisk.v1.RiceDeltaEncoding\"\221" - + "\001\n\023ThreatEntryRemovals\0228\n\013raw_indices\030\001 " - + "\001(\0132#.google.cloud.webrisk.v1.RawIndices" - + "\022@\n\014rice_indices\030\002 \001(\0132*.google.cloud.we" - + "brisk.v1.RiceDeltaEncoding\"\035\n\nRawIndices" - + "\022\017\n\007indices\030\001 \003(\005\"4\n\tRawHashes\022\023\n\013prefix" - + "_size\030\001 \001(\005\022\022\n\nraw_hashes\030\002 \001(\014\"k\n\021RiceD" - + "eltaEncoding\022\023\n\013first_value\030\001 \001(\003\022\026\n\016ric" - + "e_parameter\030\002 \001(\005\022\023\n\013entry_count\030\003 \001(\005\022\024" - + "\n\014encoded_data\030\004 \001(\014\"\036\n\nSubmission\022\020\n\003ur" - + "i\030\001 \001(\tB\003\340A\002\"\234\001\n\027CreateSubmissionRequest" - + "\022C\n\006parent\030\001 \001(\tB3\340A\002\372A-\n+cloudresourcem" - + "anager.googleapis.com/Project\022<\n\nsubmiss" - + "ion\030\002 \001(\0132#.google.cloud.webrisk.v1.Subm" - + "issionB\003\340A\002*\217\001\n\nThreatType\022\033\n\027THREAT_TYP" - + "E_UNSPECIFIED\020\000\022\013\n\007MALWARE\020\001\022\026\n\022SOCIAL_E" - + "NGINEERING\020\002\022\025\n\021UNWANTED_SOFTWARE\020\003\022(\n$S" - + "OCIAL_ENGINEERING_EXTENDED_COVERAGE\020\004*F\n" - + "\017CompressionType\022 \n\034COMPRESSION_TYPE_UNS" - + "PECIFIED\020\000\022\007\n\003RAW\020\001\022\010\n\004RICE\020\0022\243\006\n\016WebRis" - + "kService\022\323\001\n\025ComputeThreatListDiff\0225.goo" - + "gle.cloud.webrisk.v1.ComputeThreatListDi" - + "ffRequest\0326.google.cloud.webrisk.v1.Comp" - + "uteThreatListDiffResponse\"K\202\323\344\223\002\035\022\033/v1/t" - + "hreatLists:computeDiff\332A%threat_type,ver" - + "sion_token,constraints\022\221\001\n\nSearchUris\022*." - + "google.cloud.webrisk.v1.SearchUrisReques" - + "t\032+.google.cloud.webrisk.v1.SearchUrisRe" - + "sponse\"*\202\323\344\223\002\021\022\017/v1/uris:search\332A\020uri,th" - + "reat_types\022\241\001\n\014SearchHashes\022,.google.clo" - + "ud.webrisk.v1.SearchHashesRequest\032-.goog" - + "le.cloud.webrisk.v1.SearchHashesResponse" - + "\"4\202\323\344\223\002\023\022\021/v1/hashes:search\332A\030hash_prefi" - + "x,threat_types\022\266\001\n\020CreateSubmission\0220.go" - + "ogle.cloud.webrisk.v1.CreateSubmissionRe" - + "quest\032#.google.cloud.webrisk.v1.Submissi" - + "on\"K\202\323\344\223\0021\"#/v1/{parent=projects/*}/subm" - + "issions:\nsubmission\332A\021parent,submission\032" - + "J\312A\026webrisk.googleapis.com\322A.https://www" - + ".googleapis.com/auth/cloud-platformB\266\001\n\025" - + "com.google.webrisk.v1B\014WebRiskProtoP\001Z5c" - + "loud.google.com/go/webrisk/apiv1/webrisk" - + "pb;webriskpb\242\002\004GCWR\252\002\027Google.Cloud.WebRi" - + "sk.V1\312\002\027Google\\Cloud\\WebRisk\\V1\352\002\032Google" - + "::Cloud::WebRisk::V1b\006proto3" + + "/api/resource.proto\032#google/longrunning/" + + "operations.proto\032\037google/protobuf/timest" + + "amp.proto\"\343\002\n\034ComputeThreatListDiffReque" + + "st\022=\n\013threat_type\030\001 \001(\0162#.google.cloud.w" + + "ebrisk.v1.ThreatTypeB\003\340A\002\022\025\n\rversion_tok" + + "en\030\002 \001(\014\022[\n\013constraints\030\003 \001(\0132A.google.c" + + "loud.webrisk.v1.ComputeThreatListDiffReq" + + "uest.ConstraintsB\003\340A\002\032\217\001\n\013Constraints\022\030\n" + + "\020max_diff_entries\030\001 \001(\005\022\034\n\024max_database_" + + "entries\030\002 \001(\005\022H\n\026supported_compressions\030" + + "\003 \003(\0162(.google.cloud.webrisk.v1.Compress" + + "ionType\"\206\004\n\035ComputeThreatListDiffRespons" + + "e\022Z\n\rresponse_type\030\004 \001(\0162C.google.cloud." + + "webrisk.v1.ComputeThreatListDiffResponse" + + ".ResponseType\022@\n\tadditions\030\005 \001(\0132-.googl" + + "e.cloud.webrisk.v1.ThreatEntryAdditions\022" + + ">\n\010removals\030\006 \001(\0132,.google.cloud.webrisk" + + ".v1.ThreatEntryRemovals\022\031\n\021new_version_t" + + "oken\030\007 \001(\014\022Q\n\010checksum\030\010 \001(\0132?.google.cl" + + "oud.webrisk.v1.ComputeThreatListDiffResp" + + "onse.Checksum\0229\n\025recommended_next_diff\030\002" + + " \001(\0132\032.google.protobuf.Timestamp\032\032\n\010Chec" + + "ksum\022\016\n\006sha256\030\001 \001(\014\"B\n\014ResponseType\022\035\n\031" + + "RESPONSE_TYPE_UNSPECIFIED\020\000\022\010\n\004DIFF\020\001\022\t\n" + + "\005RESET\020\002\"e\n\021SearchUrisRequest\022\020\n\003uri\030\001 \001" + + "(\tB\003\340A\002\022>\n\014threat_types\030\002 \003(\0162#.google.c" + + "loud.webrisk.v1.ThreatTypeB\003\340A\002\"\324\001\n\022Sear" + + "chUrisResponse\022E\n\006threat\030\001 \001(\01325.google." + + "cloud.webrisk.v1.SearchUrisResponse.Thre" + + "atUri\032w\n\tThreatUri\0229\n\014threat_types\030\001 \003(\016" + + "2#.google.cloud.webrisk.v1.ThreatType\022/\n" + + "\013expire_time\030\002 \001(\0132\032.google.protobuf.Tim" + + "estamp\"j\n\023SearchHashesRequest\022\023\n\013hash_pr" + + "efix\030\001 \001(\014\022>\n\014threat_types\030\002 \003(\0162#.googl" + + "e.cloud.webrisk.v1.ThreatTypeB\003\340A\002\"\244\002\n\024S" + + "earchHashesResponse\022I\n\007threats\030\001 \003(\01328.g" + + "oogle.cloud.webrisk.v1.SearchHashesRespo" + + "nse.ThreatHash\0228\n\024negative_expire_time\030\002" + + " \001(\0132\032.google.protobuf.Timestamp\032\206\001\n\nThr" + + "eatHash\0229\n\014threat_types\030\001 \003(\0162#.google.c" + + "loud.webrisk.v1.ThreatType\022\014\n\004hash\030\002 \001(\014" + + "\022/\n\013expire_time\030\003 \001(\0132\032.google.protobuf." + + "Timestamp\"\217\001\n\024ThreatEntryAdditions\0226\n\nra" + + "w_hashes\030\001 \003(\0132\".google.cloud.webrisk.v1" + + ".RawHashes\022?\n\013rice_hashes\030\002 \001(\0132*.google" + + ".cloud.webrisk.v1.RiceDeltaEncoding\"\221\001\n\023" + + "ThreatEntryRemovals\0228\n\013raw_indices\030\001 \001(\013" + + "2#.google.cloud.webrisk.v1.RawIndices\022@\n" + + "\014rice_indices\030\002 \001(\0132*.google.cloud.webri" + + "sk.v1.RiceDeltaEncoding\"\035\n\nRawIndices\022\017\n" + + "\007indices\030\001 \003(\005\"4\n\tRawHashes\022\023\n\013prefix_si" + + "ze\030\001 \001(\005\022\022\n\nraw_hashes\030\002 \001(\014\"k\n\021RiceDelt" + + "aEncoding\022\023\n\013first_value\030\001 \001(\003\022\026\n\016rice_p" + + "arameter\030\002 \001(\005\022\023\n\013entry_count\030\003 \001(\005\022\024\n\014e" + + "ncoded_data\030\004 \001(\014\"^\n\nSubmission\022\020\n\003uri\030\001" + + " \001(\tB\003\340A\002\022>\n\014threat_types\030\002 \003(\0162#.google" + + ".cloud.webrisk.v1.ThreatTypeB\003\340A\003\"\245\006\n\nTh" + + "reatInfo\022A\n\nabuse_type\030\001 \001(\0162-.google.cl" + + "oud.webrisk.v1.ThreatInfo.AbuseType\022I\n\021t" + + "hreat_confidence\030\002 \001(\0132..google.cloud.we" + + "brisk.v1.ThreatInfo.Confidence\022U\n\024threat" + + "_justification\030\003 \001(\01327.google.cloud.webr" + + "isk.v1.ThreatInfo.ThreatJustification\032\313\001" + + "\n\nConfidence\022\017\n\005score\030\001 \001(\002H\000\022O\n\005level\030\002" + + " \001(\0162>.google.cloud.webrisk.v1.ThreatInf" + + "o.Confidence.ConfidenceLevelH\000\"R\n\017Confid" + + "enceLevel\022 \n\034CONFIDENCE_LEVEL_UNSPECIFIE" + + "D\020\000\022\007\n\003LOW\020\001\022\n\n\006MEDIUM\020\002\022\010\n\004HIGH\020\003B\007\n\005va" + + "lue\032\376\001\n\023ThreatJustification\022Z\n\006labels\030\001 " + + "\003(\0162J.google.cloud.webrisk.v1.ThreatInfo" + + ".ThreatJustification.JustificationLabel\022" + + "\020\n\010comments\030\002 \003(\t\"y\n\022JustificationLabel\022" + + "#\n\037JUSTIFICATION_LABEL_UNSPECIFIED\020\000\022\027\n\023" + + "MANUAL_VERIFICATION\020\001\022\017\n\013USER_REPORT\020\002\022\024" + + "\n\020AUTOMATED_REPORT\020\003\"c\n\tAbuseType\022\032\n\026ABU" + + "SE_TYPE_UNSPECIFIED\020\000\022\013\n\007MALWARE\020\001\022\026\n\022SO" + + "CIAL_ENGINEERING\020\002\022\025\n\021UNWANTED_SOFTWARE\020" + + "\003\"\300\001\n\017ThreatDiscovery\022C\n\010platform\030\001 \001(\0162" + + "1.google.cloud.webrisk.v1.ThreatDiscover" + + "y.Platform\022\024\n\014region_codes\030\002 \003(\t\"R\n\010Plat" + + "form\022\030\n\024PLATFORM_UNSPECIFIED\020\000\022\013\n\007ANDROI" + + "D\020\001\022\007\n\003IOS\020\002\022\t\n\005MACOS\020\003\022\013\n\007WINDOWS\020\004\"\234\001\n" + + "\027CreateSubmissionRequest\022C\n\006parent\030\001 \001(\t" + + "B3\340A\002\372A-\n+cloudresourcemanager.googleapi" + + "s.com/Project\022<\n\nsubmission\030\002 \001(\0132#.goog" + + "le.cloud.webrisk.v1.SubmissionB\003\340A\002\"\223\002\n\020" + + "SubmitUriRequest\022C\n\006parent\030\001 \001(\tB3\340A\002\372A-" + + "\n+cloudresourcemanager.googleapis.com/Pr" + + "oject\022<\n\nsubmission\030\002 \001(\0132#.google.cloud" + + ".webrisk.v1.SubmissionB\003\340A\002\0228\n\013threat_in" + + "fo\030\003 \001(\0132#.google.cloud.webrisk.v1.Threa" + + "tInfo\022B\n\020threat_discovery\030\004 \001(\0132(.google" + + ".cloud.webrisk.v1.ThreatDiscovery\"\231\002\n\021Su" + + "bmitUriMetadata\022?\n\005state\030\001 \001(\01620.google." + + "cloud.webrisk.v1.SubmitUriMetadata.State" + + "\022/\n\013create_time\030\002 \001(\0132\032.google.protobuf." + + "Timestamp\022/\n\013update_time\030\003 \001(\0132\032.google." + + "protobuf.Timestamp\"a\n\005State\022\025\n\021STATE_UNS" + + "PECIFIED\020\000\022\013\n\007RUNNING\020\001\022\r\n\tSUCCEEDED\020\002\022\r" + + "\n\tCANCELLED\020\003\022\n\n\006FAILED\020\004\022\n\n\006CLOSED\020\005*\217\001" + + "\n\nThreatType\022\033\n\027THREAT_TYPE_UNSPECIFIED\020" + + "\000\022\013\n\007MALWARE\020\001\022\026\n\022SOCIAL_ENGINEERING\020\002\022\025" + + "\n\021UNWANTED_SOFTWARE\020\003\022(\n$SOCIAL_ENGINEER" + + "ING_EXTENDED_COVERAGE\020\004*F\n\017CompressionTy" + + "pe\022 \n\034COMPRESSION_TYPE_UNSPECIFIED\020\000\022\007\n\003" + + "RAW\020\001\022\010\n\004RICE\020\0022\315\007\n\016WebRiskService\022\323\001\n\025C" + + "omputeThreatListDiff\0225.google.cloud.webr" + + "isk.v1.ComputeThreatListDiffRequest\0326.go" + + "ogle.cloud.webrisk.v1.ComputeThreatListD" + + "iffResponse\"K\202\323\344\223\002\035\022\033/v1/threatLists:com" + + "puteDiff\332A%threat_type,version_token,con" + + "straints\022\221\001\n\nSearchUris\022*.google.cloud.w" + + "ebrisk.v1.SearchUrisRequest\032+.google.clo" + + "ud.webrisk.v1.SearchUrisResponse\"*\202\323\344\223\002\021" + + "\022\017/v1/uris:search\332A\020uri,threat_types\022\241\001\n" + + "\014SearchHashes\022,.google.cloud.webrisk.v1." + + "SearchHashesRequest\032-.google.cloud.webri" + + "sk.v1.SearchHashesResponse\"4\202\323\344\223\002\023\022\021/v1/" + + "hashes:search\332A\030hash_prefix,threat_types" + + "\022\266\001\n\020CreateSubmission\0220.google.cloud.web" + + "risk.v1.CreateSubmissionRequest\032#.google" + + ".cloud.webrisk.v1.Submission\"K\202\323\344\223\0021\"#/v" + + "1/{parent=projects/*}/submissions:\nsubmi" + + "ssion\332A\021parent,submission\022\247\001\n\tSubmitUri\022" + + ").google.cloud.webrisk.v1.SubmitUriReque" + + "st\032\035.google.longrunning.Operation\"P\202\323\344\223\002" + + "(\"#/v1/{parent=projects/*}/uris:submit:\001" + + "*\312A\037\n\nSubmission\022\021SubmitUriMetadata\032J\312A\026" + + "webrisk.googleapis.com\322A.https://www.goo" + + "gleapis.com/auth/cloud-platformB\266\001\n\025com." + + "google.webrisk.v1B\014WebRiskProtoP\001Z5cloud" + + ".google.com/go/webrisk/apiv1/webriskpb;w" + + "ebriskpb\242\002\004GCWR\252\002\027Google.Cloud.WebRisk.V" + + "1\312\002\027Google\\Cloud\\WebRisk\\V1\352\002\032Google::Cl" + + "oud::WebRisk::V1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -206,6 +276,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { com.google.api.ClientProto.getDescriptor(), com.google.api.FieldBehaviorProto.getDescriptor(), com.google.api.ResourceProto.getDescriptor(), + com.google.longrunning.OperationsProto.getDescriptor(), com.google.protobuf.TimestampProto.getDescriptor(), }); internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffRequest_descriptor = @@ -347,16 +418,64 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_webrisk_v1_Submission_descriptor, new java.lang.String[] { - "Uri", + "Uri", "ThreatTypes", }); - internal_static_google_cloud_webrisk_v1_CreateSubmissionRequest_descriptor = + internal_static_google_cloud_webrisk_v1_ThreatInfo_descriptor = getDescriptor().getMessageTypes().get(12); + internal_static_google_cloud_webrisk_v1_ThreatInfo_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_webrisk_v1_ThreatInfo_descriptor, + new java.lang.String[] { + "AbuseType", "ThreatConfidence", "ThreatJustification", + }); + internal_static_google_cloud_webrisk_v1_ThreatInfo_Confidence_descriptor = + internal_static_google_cloud_webrisk_v1_ThreatInfo_descriptor.getNestedTypes().get(0); + internal_static_google_cloud_webrisk_v1_ThreatInfo_Confidence_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_webrisk_v1_ThreatInfo_Confidence_descriptor, + new java.lang.String[] { + "Score", "Level", "Value", + }); + internal_static_google_cloud_webrisk_v1_ThreatInfo_ThreatJustification_descriptor = + internal_static_google_cloud_webrisk_v1_ThreatInfo_descriptor.getNestedTypes().get(1); + internal_static_google_cloud_webrisk_v1_ThreatInfo_ThreatJustification_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_webrisk_v1_ThreatInfo_ThreatJustification_descriptor, + new java.lang.String[] { + "Labels", "Comments", + }); + internal_static_google_cloud_webrisk_v1_ThreatDiscovery_descriptor = + getDescriptor().getMessageTypes().get(13); + internal_static_google_cloud_webrisk_v1_ThreatDiscovery_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_webrisk_v1_ThreatDiscovery_descriptor, + new java.lang.String[] { + "Platform", "RegionCodes", + }); + internal_static_google_cloud_webrisk_v1_CreateSubmissionRequest_descriptor = + getDescriptor().getMessageTypes().get(14); internal_static_google_cloud_webrisk_v1_CreateSubmissionRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_webrisk_v1_CreateSubmissionRequest_descriptor, new java.lang.String[] { "Parent", "Submission", }); + internal_static_google_cloud_webrisk_v1_SubmitUriRequest_descriptor = + getDescriptor().getMessageTypes().get(15); + internal_static_google_cloud_webrisk_v1_SubmitUriRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_webrisk_v1_SubmitUriRequest_descriptor, + new java.lang.String[] { + "Parent", "Submission", "ThreatInfo", "ThreatDiscovery", + }); + internal_static_google_cloud_webrisk_v1_SubmitUriMetadata_descriptor = + getDescriptor().getMessageTypes().get(16); + internal_static_google_cloud_webrisk_v1_SubmitUriMetadata_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_webrisk_v1_SubmitUriMetadata_descriptor, + new java.lang.String[] { + "State", "CreateTime", "UpdateTime", + }); com.google.protobuf.ExtensionRegistry registry = com.google.protobuf.ExtensionRegistry.newInstance(); registry.add(com.google.api.ClientProto.defaultHost); @@ -365,12 +484,14 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { registry.add(com.google.api.ClientProto.methodSignature); registry.add(com.google.api.ClientProto.oauthScopes); registry.add(com.google.api.ResourceProto.resourceReference); + registry.add(com.google.longrunning.OperationsProto.operationInfo); com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( descriptor, registry); com.google.api.AnnotationsProto.getDescriptor(); com.google.api.ClientProto.getDescriptor(); com.google.api.FieldBehaviorProto.getDescriptor(); com.google.api.ResourceProto.getDescriptor(); + com.google.longrunning.OperationsProto.getDescriptor(); com.google.protobuf.TimestampProto.getDescriptor(); } diff --git a/java-webrisk/proto-google-cloud-webrisk-v1/src/main/proto/google/cloud/webrisk/v1/webrisk.proto b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/proto/google/cloud/webrisk/v1/webrisk.proto index 47281fe7f18f..5c5f63929d63 100644 --- a/java-webrisk/proto-google-cloud-webrisk-v1/src/main/proto/google/cloud/webrisk/v1/webrisk.proto +++ b/java-webrisk/proto-google-cloud-webrisk-v1/src/main/proto/google/cloud/webrisk/v1/webrisk.proto @@ -20,6 +20,7 @@ import "google/api/annotations.proto"; import "google/api/client.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; import "google/protobuf/timestamp.proto"; option csharp_namespace = "Google.Cloud.WebRisk.V1"; @@ -35,7 +36,8 @@ option ruby_package = "Google::Cloud::WebRisk::V1"; // website and in client applications. service WebRiskService { option (google.api.default_host) = "webrisk.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; // Gets the most recent threat list diffs. These diffs should be applied to // a local database of hashes to keep it up-to-date. If the local database is @@ -43,11 +45,13 @@ service WebRiskService { // be returned. This Method only updates a single ThreatList at a time. To // update multiple ThreatList databases, this method needs to be called once // for each list. - rpc ComputeThreatListDiff(ComputeThreatListDiffRequest) returns (ComputeThreatListDiffResponse) { + rpc ComputeThreatListDiff(ComputeThreatListDiffRequest) + returns (ComputeThreatListDiffResponse) { option (google.api.http) = { get: "/v1/threatLists:computeDiff" }; - option (google.api.method_signature) = "threat_type,version_token,constraints"; + option (google.api.method_signature) = + "threat_type,version_token,constraints"; } // This method is used to check whether a URI is on a given threatList. @@ -88,6 +92,27 @@ service WebRiskService { }; option (google.api.method_signature) = "parent,submission"; } + + // Submits a URI suspected of containing malicious content to be reviewed. + // Returns a google.longrunning.Operation which, once the review is complete, + // is updated with its result. You can use the [Pub/Sub API] + // (https://cloud.google.com/pubsub) to receive notifications for the returned + // Operation. If the result verifies the existence of malicious content, the + // site will be added to the [Google's Social Engineering lists] + // (https://support.google.com/webmasters/answer/6350487/) in order to + // protect users that could get exposed to this threat in the future. Only + // allowlisted projects can use this method during Early Access. Please reach + // out to Sales or your customer engineer to obtain access. + rpc SubmitUri(SubmitUriRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*}/uris:submit" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Submission" + metadata_type: "SubmitUriMetadata" + }; + } } // Describes an API diff request. @@ -108,9 +133,9 @@ message ComputeThreatListDiffRequest { repeated CompressionType supported_compressions = 3; } - // Required. The threat list to update. Only a single ThreatType should be specified - // per request. If you want to handle multiple ThreatTypes, you must make one - // request per ThreatType. + // Required. The threat list to update. Only a single ThreatType should be + // specified per request. If you want to handle multiple ThreatTypes, you must + // make one request per ThreatType. ThreatType threat_type = 1 [(google.api.field_behavior) = REQUIRED]; // The current version token of the client for the requested list (the @@ -180,7 +205,8 @@ message SearchUrisRequest { // Required. The URI to be checked for matches. string uri = 1 [(google.api.field_behavior) = REQUIRED]; - // Required. The ThreatLists to search in. Multiple ThreatLists may be specified. + // Required. The ThreatLists to search in. Multiple ThreatLists may be + // specified. repeated ThreatType threat_types = 2 [(google.api.field_behavior) = REQUIRED]; } @@ -207,7 +233,8 @@ message SearchHashesRequest { // the web safe base64 variant (RFC 4648). bytes hash_prefix = 1; - // Required. The ThreatLists to search in. Multiple ThreatLists may be specified. + // Required. The ThreatLists to search in. Multiple ThreatLists may be + // specified. repeated ThreatType threat_types = 2 [(google.api.field_behavior) = REQUIRED]; } @@ -342,14 +369,130 @@ message RiceDeltaEncoding { // Wraps a URI that might be displaying malicious content. message Submission { - // Required. The URI that is being reported for malicious content to be analyzed. + // Required. The URI that is being reported for malicious content to be + // analyzed. string uri = 1 [(google.api.field_behavior) = REQUIRED]; + + // Output only. ThreatTypes found to be associated with the submitted URI + // after reviewing it. This might be empty if the URI was not added to any + // list. + repeated ThreatType threat_types = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Context about the submission including the type of abuse found on the URI and +// supporting details. +// option (google.api.message_visibility).restriction = "TRUSTED_TESTER"; +message ThreatInfo { + // The abuse type found on the URI. + enum AbuseType { + // Default. + ABUSE_TYPE_UNSPECIFIED = 0; + + // The URI contains malware. + MALWARE = 1; + + // The URI contains social engineering. + SOCIAL_ENGINEERING = 2; + + // The URI contains unwanted software. + UNWANTED_SOFTWARE = 3; + } + + // Confidence that a URI is unsafe. + message Confidence { + // Enum representation of confidence. + enum ConfidenceLevel { + // Default. + CONFIDENCE_LEVEL_UNSPECIFIED = 0; + + // Less than 60% confidence that the URI is unsafe. + LOW = 1; + + // Between 60% and 80% confidence that the URI is unsafe. + MEDIUM = 2; + + // Greater than 80% confidence that the URI is unsafe. + HIGH = 3; + } + + oneof value { + // A decimal representation of confidence in the range of 0 + // to 1 where 0 indicates no confidence and 1 indicates + // complete confidence. + float score = 1; + + // Enum representation of confidence. + ConfidenceLevel level = 2; + } + } + + // Context about why the URI is unsafe. + message ThreatJustification { + // Labels that explain how the URI was classified. + enum JustificationLabel { + // Default. + JUSTIFICATION_LABEL_UNSPECIFIED = 0; + + // The submitter manually verified that the submission is unsafe. + MANUAL_VERIFICATION = 1; + + // The submitter received the submission from an end user. + USER_REPORT = 2; + + // The submitter received the submission from an automated system. + AUTOMATED_REPORT = 3; + } + + // Labels associated with this URI that explain how it was classified. + repeated JustificationLabel labels = 1; + + // Free-form context on why this URI is unsafe. + repeated string comments = 2; + } + + // The type of abuse. + AbuseType abuse_type = 1; + + // Confidence that the URI is unsafe. + Confidence threat_confidence = 2; + + // Context about why the URI is unsafe. + ThreatJustification threat_justification = 3; +} + +// Details about how the threat was discovered. +message ThreatDiscovery { + // Platform types. + enum Platform { + // Default. + PLATFORM_UNSPECIFIED = 0; + + // General Android platform. + ANDROID = 1; + + // General iOS platform. + IOS = 2; + + // General macOS platform. + MACOS = 3; + + // General Windows platform. + WINDOWS = 4; + } + + // Platform on which the threat was discovered. + Platform platform = 1; + + // CLDR region code of the countries/regions the URI poses a threat ordered + // from most impact to least impact. Example: "US" for United States. + repeated string region_codes = 2; } // Request to send a potentially phishy URI to WebRisk. message CreateSubmissionRequest { - // Required. The name of the project that is making the submission. This string is in - // the format "projects/{project_number}". + // Required. The name of the project that is making the submission. This + // string is in the format "projects/{project_number}". string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -360,3 +503,58 @@ message CreateSubmissionRequest { // Required. The submission that contains the content of the phishing report. Submission submission = 2 [(google.api.field_behavior) = REQUIRED]; } + +// Request to send a potentially malicious URI to WebRisk. +message SubmitUriRequest { + // Required. The name of the project that is making the submission. This + // string is in the format "projects/{project_number}". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // Required. The submission that contains the URI to be scanned. + Submission submission = 2 [(google.api.field_behavior) = REQUIRED]; + + // Provides additional information about the submission. + ThreatInfo threat_info = 3; + + // Provides additional information about how the submission was discovered. + ThreatDiscovery threat_discovery = 4; +} + +// Metadata for the Submit URI long-running operation. +// option (google.api.message_visibility).restriction = "TRUSTED_TESTER"; +message SubmitUriMetadata { + // Enum that represents the state of the long-running operation. + enum State { + // Default unspecified state. + STATE_UNSPECIFIED = 0; + + // The operation is currently running. + RUNNING = 1; + + // The operation finished with a success status. + SUCCEEDED = 2; + + // The operation was cancelled. + CANCELLED = 3; + + // The operation finished with a failure status. + FAILED = 4; + + // The operation was closed with no action taken. + CLOSED = 5; + } + + // The state of the operation. + State state = 1; + + // Creation time of the operation. + google.protobuf.Timestamp create_time = 2; + + // Latest update time of the operation. + google.protobuf.Timestamp update_time = 3; +} diff --git a/java-webrisk/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskservice/submituri/AsyncSubmitUri.java b/java-webrisk/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskservice/submituri/AsyncSubmitUri.java new file mode 100644 index 000000000000..f038ef468a06 --- /dev/null +++ b/java-webrisk/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskservice/submituri/AsyncSubmitUri.java @@ -0,0 +1,55 @@ +/* + * Copyright 2022 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.webrisk.v1.samples; + +// [START webrisk_v1_generated_WebRiskService_SubmitUri_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.webrisk.v1.WebRiskServiceClient; +import com.google.longrunning.Operation; +import com.google.webrisk.v1.ProjectName; +import com.google.webrisk.v1.Submission; +import com.google.webrisk.v1.SubmitUriRequest; +import com.google.webrisk.v1.ThreatDiscovery; +import com.google.webrisk.v1.ThreatInfo; + +public class AsyncSubmitUri { + + public static void main(String[] args) throws Exception { + asyncSubmitUri(); + } + + public static void asyncSubmitUri() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) { + SubmitUriRequest request = + SubmitUriRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setSubmission(Submission.newBuilder().build()) + .setThreatInfo(ThreatInfo.newBuilder().build()) + .setThreatDiscovery(ThreatDiscovery.newBuilder().build()) + .build(); + ApiFuture future = webRiskServiceClient.submitUriCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END webrisk_v1_generated_WebRiskService_SubmitUri_async] diff --git a/java-webrisk/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskservice/submituri/AsyncSubmitUriLRO.java b/java-webrisk/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskservice/submituri/AsyncSubmitUriLRO.java new file mode 100644 index 000000000000..e070158175be --- /dev/null +++ b/java-webrisk/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskservice/submituri/AsyncSubmitUriLRO.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 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.webrisk.v1.samples; + +// [START webrisk_v1_generated_WebRiskService_SubmitUri_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.webrisk.v1.WebRiskServiceClient; +import com.google.webrisk.v1.ProjectName; +import com.google.webrisk.v1.Submission; +import com.google.webrisk.v1.SubmitUriMetadata; +import com.google.webrisk.v1.SubmitUriRequest; +import com.google.webrisk.v1.ThreatDiscovery; +import com.google.webrisk.v1.ThreatInfo; + +public class AsyncSubmitUriLRO { + + public static void main(String[] args) throws Exception { + asyncSubmitUriLRO(); + } + + public static void asyncSubmitUriLRO() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) { + SubmitUriRequest request = + SubmitUriRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setSubmission(Submission.newBuilder().build()) + .setThreatInfo(ThreatInfo.newBuilder().build()) + .setThreatDiscovery(ThreatDiscovery.newBuilder().build()) + .build(); + OperationFuture future = + webRiskServiceClient.submitUriOperationCallable().futureCall(request); + // Do something. + Submission response = future.get(); + } + } +} +// [END webrisk_v1_generated_WebRiskService_SubmitUri_LRO_async] diff --git a/java-webrisk/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskservice/submituri/SyncSubmitUri.java b/java-webrisk/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskservice/submituri/SyncSubmitUri.java new file mode 100644 index 000000000000..2dd183784553 --- /dev/null +++ b/java-webrisk/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskservice/submituri/SyncSubmitUri.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 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.webrisk.v1.samples; + +// [START webrisk_v1_generated_WebRiskService_SubmitUri_sync] +import com.google.cloud.webrisk.v1.WebRiskServiceClient; +import com.google.webrisk.v1.ProjectName; +import com.google.webrisk.v1.Submission; +import com.google.webrisk.v1.SubmitUriRequest; +import com.google.webrisk.v1.ThreatDiscovery; +import com.google.webrisk.v1.ThreatInfo; + +public class SyncSubmitUri { + + public static void main(String[] args) throws Exception { + syncSubmitUri(); + } + + public static void syncSubmitUri() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) { + SubmitUriRequest request = + SubmitUriRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setSubmission(Submission.newBuilder().build()) + .setThreatInfo(ThreatInfo.newBuilder().build()) + .setThreatDiscovery(ThreatDiscovery.newBuilder().build()) + .build(); + Submission response = webRiskServiceClient.submitUriAsync(request).get(); + } + } +} +// [END webrisk_v1_generated_WebRiskService_SubmitUri_sync]