From 4d888599519827c8d5a5a6199d711d70128bf61c Mon Sep 17 00:00:00 2001 From: Jeff Ching Date: Mon, 16 Mar 2020 11:10:49 -0700 Subject: [PATCH] feat(v1): add v1 client (#84) --- google-cloud-webrisk-bom/pom.xml | 11 +- google-cloud-webrisk/pom.xml | 9 + .../webrisk/v1/WebRiskServiceClient.java | 576 ++++ .../webrisk/v1/WebRiskServiceSettings.java | 221 ++ .../google/cloud/webrisk/v1/package-info.java | 43 + .../GrpcWebRiskServiceCallableFactory.java | 115 + .../v1/stub/GrpcWebRiskServiceStub.java | 230 ++ .../webrisk/v1/stub/WebRiskServiceStub.java | 60 + .../v1/stub/WebRiskServiceStubSettings.java | 357 +++ .../cloud/webrisk/v1/MockWebRiskService.java | 57 + .../webrisk/v1/MockWebRiskServiceImpl.java | 127 + .../webrisk/v1/WebRiskServiceClientTest.java | 262 ++ grpc-google-cloud-webrisk-v1/pom.xml | 56 + .../google/webrisk/v1/WebRiskServiceGrpc.java | 763 +++++ pom.xml | 12 + proto-google-cloud-webrisk-v1/pom.xml | 33 + .../google/webrisk/v1/CompressionType.java | 172 ++ .../v1/ComputeThreatListDiffRequest.java | 2164 ++++++++++++++ ...ComputeThreatListDiffRequestOrBuilder.java | 112 + .../v1/ComputeThreatListDiffResponse.java | 2622 +++++++++++++++++ ...omputeThreatListDiffResponseOrBuilder.java | 230 ++ .../webrisk/v1/CreateSubmissionRequest.java | 950 ++++++ .../v1/CreateSubmissionRequestOrBuilder.java | 97 + .../com/google/webrisk/v1/ProjectName.java | 162 + .../java/com/google/webrisk/v1/RawHashes.java | 658 +++++ .../google/webrisk/v1/RawHashesOrBuilder.java | 55 + .../com/google/webrisk/v1/RawIndices.java | 698 +++++ .../webrisk/v1/RawIndicesOrBuilder.java | 63 + .../google/webrisk/v1/RiceDeltaEncoding.java | 832 ++++++ .../v1/RiceDeltaEncodingOrBuilder.java | 82 + .../webrisk/v1/SearchHashesRequest.java | 971 ++++++ .../v1/SearchHashesRequestOrBuilder.java | 112 + .../webrisk/v1/SearchHashesResponse.java | 2601 ++++++++++++++++ .../v1/SearchHashesResponseOrBuilder.java | 120 + .../google/webrisk/v1/SearchUrisRequest.java | 1051 +++++++ .../v1/SearchUrisRequestOrBuilder.java | 123 + .../google/webrisk/v1/SearchUrisResponse.java | 1933 ++++++++++++ .../v1/SearchUrisResponseOrBuilder.java | 60 + .../com/google/webrisk/v1/Submission.java | 628 ++++ .../webrisk/v1/SubmissionOrBuilder.java | 50 + .../webrisk/v1/ThreatEntryAdditions.java | 1263 ++++++++ .../v1/ThreatEntryAdditionsOrBuilder.java | 122 + .../webrisk/v1/ThreatEntryRemovals.java | 1037 +++++++ .../v1/ThreatEntryRemovalsOrBuilder.java | 104 + .../com/google/webrisk/v1/ThreatType.java | 195 ++ .../com/google/webrisk/v1/WebRiskProto.java | 377 +++ .../google/cloud/webrisk/v1/webrisk.proto | 352 +++ synth.metadata | 24 +- synth.py | 6 +- 49 files changed, 22952 insertions(+), 6 deletions(-) create mode 100644 google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/WebRiskServiceClient.java create mode 100644 google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/WebRiskServiceSettings.java create mode 100644 google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/package-info.java create mode 100644 google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/GrpcWebRiskServiceCallableFactory.java create mode 100644 google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/GrpcWebRiskServiceStub.java create mode 100644 google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/WebRiskServiceStub.java create mode 100644 google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/WebRiskServiceStubSettings.java create mode 100644 google-cloud-webrisk/src/test/java/com/google/cloud/webrisk/v1/MockWebRiskService.java create mode 100644 google-cloud-webrisk/src/test/java/com/google/cloud/webrisk/v1/MockWebRiskServiceImpl.java create mode 100644 google-cloud-webrisk/src/test/java/com/google/cloud/webrisk/v1/WebRiskServiceClientTest.java create mode 100644 grpc-google-cloud-webrisk-v1/pom.xml create mode 100644 grpc-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/WebRiskServiceGrpc.java create mode 100644 proto-google-cloud-webrisk-v1/pom.xml create mode 100644 proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/CompressionType.java create mode 100644 proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ComputeThreatListDiffRequest.java create mode 100644 proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ComputeThreatListDiffRequestOrBuilder.java create mode 100644 proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ComputeThreatListDiffResponse.java create mode 100644 proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ComputeThreatListDiffResponseOrBuilder.java create mode 100644 proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/CreateSubmissionRequest.java create mode 100644 proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/CreateSubmissionRequestOrBuilder.java create mode 100644 proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ProjectName.java create mode 100644 proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/RawHashes.java create mode 100644 proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/RawHashesOrBuilder.java create mode 100644 proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/RawIndices.java create mode 100644 proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/RawIndicesOrBuilder.java create mode 100644 proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/RiceDeltaEncoding.java create mode 100644 proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/RiceDeltaEncodingOrBuilder.java create mode 100644 proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchHashesRequest.java create mode 100644 proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchHashesRequestOrBuilder.java create mode 100644 proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchHashesResponse.java create mode 100644 proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchHashesResponseOrBuilder.java create mode 100644 proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchUrisRequest.java create mode 100644 proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchUrisRequestOrBuilder.java create mode 100644 proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchUrisResponse.java create mode 100644 proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchUrisResponseOrBuilder.java create mode 100644 proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/Submission.java create mode 100644 proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SubmissionOrBuilder.java create mode 100644 proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatEntryAdditions.java create mode 100644 proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatEntryAdditionsOrBuilder.java create mode 100644 proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatEntryRemovals.java create mode 100644 proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatEntryRemovalsOrBuilder.java create mode 100644 proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatType.java create mode 100644 proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/WebRiskProto.java create mode 100644 proto-google-cloud-webrisk-v1/src/main/proto/google/cloud/webrisk/v1/webrisk.proto diff --git a/google-cloud-webrisk-bom/pom.xml b/google-cloud-webrisk-bom/pom.xml index a9f40273..75c6e2bb 100644 --- a/google-cloud-webrisk-bom/pom.xml +++ b/google-cloud-webrisk-bom/pom.xml @@ -60,17 +60,26 @@ - com.google.cloud google-cloud-webrisk 0.32.2-SNAPSHOT + + com.google.api.grpc + grpc-google-cloud-webrisk-v1 + 0.32.2-SNAPSHOT + com.google.api.grpc grpc-google-cloud-webrisk-v1beta1 0.32.2-SNAPSHOT + + com.google.api.grpc + proto-google-cloud-webrisk-v1 + 0.32.2-SNAPSHOT + com.google.api.grpc proto-google-cloud-webrisk-v1beta1 diff --git a/google-cloud-webrisk/pom.xml b/google-cloud-webrisk/pom.xml index 0f777278..55339a60 100644 --- a/google-cloud-webrisk/pom.xml +++ b/google-cloud-webrisk/pom.xml @@ -42,6 +42,10 @@ proto-google-common-protos + + com.google.api.grpc + proto-google-cloud-webrisk-v1 + com.google.api.grpc proto-google-cloud-webrisk-v1beta1 @@ -70,6 +74,11 @@ test + + com.google.api.grpc + grpc-google-cloud-webrisk-v1 + test + com.google.api.grpc grpc-google-cloud-webrisk-v1beta1 diff --git a/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/WebRiskServiceClient.java b/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/WebRiskServiceClient.java new file mode 100644 index 00000000..ce158814 --- /dev/null +++ b/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/WebRiskServiceClient.java @@ -0,0 +1,576 @@ +/* + * 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. + */ +package com.google.cloud.webrisk.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +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.protobuf.ByteString; +import com.google.webrisk.v1.ComputeThreatListDiffRequest; +import com.google.webrisk.v1.ComputeThreatListDiffResponse; +import com.google.webrisk.v1.CreateSubmissionRequest; +import com.google.webrisk.v1.ProjectName; +import com.google.webrisk.v1.SearchHashesRequest; +import com.google.webrisk.v1.SearchHashesResponse; +import com.google.webrisk.v1.SearchUrisRequest; +import com.google.webrisk.v1.SearchUrisResponse; +import com.google.webrisk.v1.Submission; +import com.google.webrisk.v1.ThreatType; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Web Risk API defines an interface to detect malicious URLs on your website + * and in client applications. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
+ *   ThreatType threatType = ThreatType.THREAT_TYPE_UNSPECIFIED;
+ *   ByteString versionToken = ByteString.copyFromUtf8("");
+ *   ComputeThreatListDiffRequest.Constraints constraints = ComputeThreatListDiffRequest.Constraints.newBuilder().build();
+ *   ComputeThreatListDiffResponse response = webRiskServiceClient.computeThreatListDiff(threatType, versionToken, constraints);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the webRiskServiceClient object to clean up resources such + * as threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of WebRiskServiceSettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * WebRiskServiceSettings webRiskServiceSettings =
+ *     WebRiskServiceSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * WebRiskServiceClient webRiskServiceClient =
+ *     WebRiskServiceClient.create(webRiskServiceSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * WebRiskServiceSettings webRiskServiceSettings =
+ *     WebRiskServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * WebRiskServiceClient webRiskServiceClient =
+ *     WebRiskServiceClient.create(webRiskServiceSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class WebRiskServiceClient implements BackgroundResource { + private final WebRiskServiceSettings settings; + private final WebRiskServiceStub stub; + + /** Constructs an instance of WebRiskServiceClient with default settings. */ + public static final WebRiskServiceClient create() throws IOException { + return create(WebRiskServiceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of WebRiskServiceClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final WebRiskServiceClient create(WebRiskServiceSettings settings) + throws IOException { + return new WebRiskServiceClient(settings); + } + + /** + * Constructs an instance of WebRiskServiceClient, using the given stub for making calls. This is + * for advanced usage - prefer to use WebRiskServiceSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final WebRiskServiceClient create(WebRiskServiceStub stub) { + return new WebRiskServiceClient(stub); + } + + /** + * Constructs an instance of WebRiskServiceClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected WebRiskServiceClient(WebRiskServiceSettings settings) throws IOException { + this.settings = settings; + this.stub = ((WebRiskServiceStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected WebRiskServiceClient(WebRiskServiceStub stub) { + this.settings = null; + this.stub = stub; + } + + public final WebRiskServiceSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public WebRiskServiceStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * 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 empty or excessively out-of-date, a + * complete snapshot of the database will 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. + * + *

Sample code: + * + *


+   * try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
+   *   ThreatType threatType = ThreatType.THREAT_TYPE_UNSPECIFIED;
+   *   ByteString versionToken = ByteString.copyFromUtf8("");
+   *   ComputeThreatListDiffRequest.Constraints constraints = ComputeThreatListDiffRequest.Constraints.newBuilder().build();
+   *   ComputeThreatListDiffResponse response = webRiskServiceClient.computeThreatListDiff(threatType, versionToken, constraints);
+   * }
+   * 
+ * + * @param threatType Required. The threat list to update. Only a single ThreatType should be + * specified. + * @param versionToken The current version token of the client for the requested list (the client + * version that was received from the last successful diff). If the client does not have a + * version token (this is the first time calling ComputeThreatListDiff), this may be left + * empty and a full database snapshot will be returned. + * @param constraints Required. The constraints associated with this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ComputeThreatListDiffResponse computeThreatListDiff( + ThreatType threatType, + ByteString versionToken, + ComputeThreatListDiffRequest.Constraints constraints) { + ComputeThreatListDiffRequest request = + ComputeThreatListDiffRequest.newBuilder() + .setThreatType(threatType) + .setVersionToken(versionToken) + .setConstraints(constraints) + .build(); + return computeThreatListDiff(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * 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 empty or excessively out-of-date, a + * complete snapshot of the database will 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. + * + *

Sample code: + * + *


+   * try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
+   *   ThreatType threatType = ThreatType.THREAT_TYPE_UNSPECIFIED;
+   *   ComputeThreatListDiffRequest.Constraints constraints = ComputeThreatListDiffRequest.Constraints.newBuilder().build();
+   *   ComputeThreatListDiffRequest request = ComputeThreatListDiffRequest.newBuilder()
+   *     .setThreatType(threatType)
+   *     .setConstraints(constraints)
+   *     .build();
+   *   ComputeThreatListDiffResponse response = webRiskServiceClient.computeThreatListDiff(request);
+   * }
+   * 
+ * + * @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 ComputeThreatListDiffResponse computeThreatListDiff( + ComputeThreatListDiffRequest request) { + return computeThreatListDiffCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * 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 empty or excessively out-of-date, a + * complete snapshot of the database will 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. + * + *

Sample code: + * + *


+   * try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
+   *   ThreatType threatType = ThreatType.THREAT_TYPE_UNSPECIFIED;
+   *   ComputeThreatListDiffRequest.Constraints constraints = ComputeThreatListDiffRequest.Constraints.newBuilder().build();
+   *   ComputeThreatListDiffRequest request = ComputeThreatListDiffRequest.newBuilder()
+   *     .setThreatType(threatType)
+   *     .setConstraints(constraints)
+   *     .build();
+   *   ApiFuture<ComputeThreatListDiffResponse> future = webRiskServiceClient.computeThreatListDiffCallable().futureCall(request);
+   *   // Do something
+   *   ComputeThreatListDiffResponse response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + computeThreatListDiffCallable() { + return stub.computeThreatListDiffCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * This method is used to check whether a URI is on a given threatList. Multiple threatLists may + * be searched in a single query. The response will list all requested threatLists the URI was + * found to match. If the URI is not found on any of the requested ThreatList an empty response + * will be returned. + * + *

Sample code: + * + *


+   * try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
+   *   String uri = "";
+   *   List<ThreatType> threatTypes = new ArrayList<>();
+   *   SearchUrisResponse response = webRiskServiceClient.searchUris(uri, threatTypes);
+   * }
+   * 
+ * + * @param uri Required. The URI to be checked for matches. + * @param threatTypes Required. The ThreatLists to search in. Multiple ThreatLists may be + * specified. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final SearchUrisResponse searchUris(String uri, List threatTypes) { + SearchUrisRequest request = + SearchUrisRequest.newBuilder().setUri(uri).addAllThreatTypes(threatTypes).build(); + return searchUris(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * This method is used to check whether a URI is on a given threatList. Multiple threatLists may + * be searched in a single query. The response will list all requested threatLists the URI was + * found to match. If the URI is not found on any of the requested ThreatList an empty response + * will be returned. + * + *

Sample code: + * + *


+   * try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
+   *   String uri = "";
+   *   List<ThreatType> threatTypes = new ArrayList<>();
+   *   SearchUrisRequest request = SearchUrisRequest.newBuilder()
+   *     .setUri(uri)
+   *     .addAllThreatTypes(threatTypes)
+   *     .build();
+   *   SearchUrisResponse response = webRiskServiceClient.searchUris(request);
+   * }
+   * 
+ * + * @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 SearchUrisResponse searchUris(SearchUrisRequest request) { + return searchUrisCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * This method is used to check whether a URI is on a given threatList. Multiple threatLists may + * be searched in a single query. The response will list all requested threatLists the URI was + * found to match. If the URI is not found on any of the requested ThreatList an empty response + * will be returned. + * + *

Sample code: + * + *


+   * try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
+   *   String uri = "";
+   *   List<ThreatType> threatTypes = new ArrayList<>();
+   *   SearchUrisRequest request = SearchUrisRequest.newBuilder()
+   *     .setUri(uri)
+   *     .addAllThreatTypes(threatTypes)
+   *     .build();
+   *   ApiFuture<SearchUrisResponse> future = webRiskServiceClient.searchUrisCallable().futureCall(request);
+   *   // Do something
+   *   SearchUrisResponse response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable searchUrisCallable() { + return stub.searchUrisCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the full hashes that match the requested hash prefix. This is used after a hash prefix is + * looked up in a threatList and there is a match. The client side threatList only holds partial + * hashes so the client must query this method to determine if there is a full hash match of a + * threat. + * + *

Sample code: + * + *


+   * try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
+   *   ByteString hashPrefix = ByteString.copyFromUtf8("");
+   *   List<ThreatType> threatTypes = new ArrayList<>();
+   *   SearchHashesResponse response = webRiskServiceClient.searchHashes(hashPrefix, threatTypes);
+   * }
+   * 
+ * + * @param hashPrefix A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 + * hash. For JSON requests, this field is base64-encoded. + * @param threatTypes Required. The ThreatLists to search in. Multiple ThreatLists may be + * specified. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final SearchHashesResponse searchHashes( + ByteString hashPrefix, List threatTypes) { + SearchHashesRequest request = + SearchHashesRequest.newBuilder() + .setHashPrefix(hashPrefix) + .addAllThreatTypes(threatTypes) + .build(); + return searchHashes(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the full hashes that match the requested hash prefix. This is used after a hash prefix is + * looked up in a threatList and there is a match. The client side threatList only holds partial + * hashes so the client must query this method to determine if there is a full hash match of a + * threat. + * + *

Sample code: + * + *


+   * try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
+   *   List<ThreatType> threatTypes = new ArrayList<>();
+   *   SearchHashesRequest request = SearchHashesRequest.newBuilder()
+   *     .addAllThreatTypes(threatTypes)
+   *     .build();
+   *   SearchHashesResponse response = webRiskServiceClient.searchHashes(request);
+   * }
+   * 
+ * + * @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 SearchHashesResponse searchHashes(SearchHashesRequest request) { + return searchHashesCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the full hashes that match the requested hash prefix. This is used after a hash prefix is + * looked up in a threatList and there is a match. The client side threatList only holds partial + * hashes so the client must query this method to determine if there is a full hash match of a + * threat. + * + *

Sample code: + * + *


+   * try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
+   *   List<ThreatType> threatTypes = new ArrayList<>();
+   *   SearchHashesRequest request = SearchHashesRequest.newBuilder()
+   *     .addAllThreatTypes(threatTypes)
+   *     .build();
+   *   ApiFuture<SearchHashesResponse> future = webRiskServiceClient.searchHashesCallable().futureCall(request);
+   *   // Do something
+   *   SearchHashesResponse response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable searchHashesCallable() { + return stub.searchHashesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a Submission of a URI suspected of containing phishing content to be reviewed. If the + * result verifies the existence of malicious phishing 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 projects with + * CREATE_SUBMISSION_USERS visibility can use this method. + * + *

Sample code: + * + *


+   * try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
+   *   Submission submission = Submission.newBuilder().build();
+   *   Submission response = webRiskServiceClient.createSubmission(parent, submission);
+   * }
+   * 
+ * + * @param parent Required. The name of the project that is making the submission. This string is + * in the format "projects/{project_number}". + * @param submission Required. The submission that contains the content of the phishing report. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Submission createSubmission(ProjectName parent, Submission submission) { + CreateSubmissionRequest request = + CreateSubmissionRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setSubmission(submission) + .build(); + return createSubmission(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a Submission of a URI suspected of containing phishing content to be reviewed. If the + * result verifies the existence of malicious phishing 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 projects with + * CREATE_SUBMISSION_USERS visibility can use this method. + * + *

Sample code: + * + *


+   * try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
+   *   Submission submission = Submission.newBuilder().build();
+   *   Submission response = webRiskServiceClient.createSubmission(parent.toString(), submission);
+   * }
+   * 
+ * + * @param parent Required. The name of the project that is making the submission. This string is + * in the format "projects/{project_number}". + * @param submission Required. The submission that contains the content of the phishing report. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Submission createSubmission(String parent, Submission submission) { + CreateSubmissionRequest request = + CreateSubmissionRequest.newBuilder().setParent(parent).setSubmission(submission).build(); + return createSubmission(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a Submission of a URI suspected of containing phishing content to be reviewed. If the + * result verifies the existence of malicious phishing 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 projects with + * CREATE_SUBMISSION_USERS visibility can use this method. + * + *

Sample code: + * + *


+   * try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
+   *   Submission submission = Submission.newBuilder().build();
+   *   CreateSubmissionRequest request = CreateSubmissionRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .setSubmission(submission)
+   *     .build();
+   *   Submission response = webRiskServiceClient.createSubmission(request);
+   * }
+   * 
+ * + * @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 Submission createSubmission(CreateSubmissionRequest request) { + return createSubmissionCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a Submission of a URI suspected of containing phishing content to be reviewed. If the + * result verifies the existence of malicious phishing 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 projects with + * CREATE_SUBMISSION_USERS visibility can use this method. + * + *

Sample code: + * + *


+   * try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
+   *   Submission submission = Submission.newBuilder().build();
+   *   CreateSubmissionRequest request = CreateSubmissionRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .setSubmission(submission)
+   *     .build();
+   *   ApiFuture<Submission> future = webRiskServiceClient.createSubmissionCallable().futureCall(request);
+   *   // Do something
+   *   Submission response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable createSubmissionCallable() { + return stub.createSubmissionCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/WebRiskServiceSettings.java b/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/WebRiskServiceSettings.java new file mode 100644 index 00000000..317d3f8a --- /dev/null +++ b/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/WebRiskServiceSettings.java @@ -0,0 +1,221 @@ +/* + * 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. + */ +package com.google.cloud.webrisk.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +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.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.webrisk.v1.stub.WebRiskServiceStubSettings; +import com.google.webrisk.v1.ComputeThreatListDiffRequest; +import com.google.webrisk.v1.ComputeThreatListDiffResponse; +import com.google.webrisk.v1.CreateSubmissionRequest; +import com.google.webrisk.v1.SearchHashesRequest; +import com.google.webrisk.v1.SearchHashesResponse; +import com.google.webrisk.v1.SearchUrisRequest; +import com.google.webrisk.v1.SearchUrisResponse; +import com.google.webrisk.v1.Submission; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link WebRiskServiceClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (webrisk.googleapis.com) and default port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of computeThreatListDiff to 30 seconds: + * + *

+ * 
+ * WebRiskServiceSettings.Builder webRiskServiceSettingsBuilder =
+ *     WebRiskServiceSettings.newBuilder();
+ * webRiskServiceSettingsBuilder
+ *     .computeThreatListDiffSettings()
+ *     .setRetrySettings(
+ *         webRiskServiceSettingsBuilder.computeThreatListDiffSettings().getRetrySettings().toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * WebRiskServiceSettings webRiskServiceSettings = webRiskServiceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class WebRiskServiceSettings extends ClientSettings { + /** Returns the object with the settings used for calls to computeThreatListDiff. */ + public UnaryCallSettings + computeThreatListDiffSettings() { + return ((WebRiskServiceStubSettings) getStubSettings()).computeThreatListDiffSettings(); + } + + /** Returns the object with the settings used for calls to searchUris. */ + public UnaryCallSettings searchUrisSettings() { + return ((WebRiskServiceStubSettings) getStubSettings()).searchUrisSettings(); + } + + /** Returns the object with the settings used for calls to searchHashes. */ + public UnaryCallSettings searchHashesSettings() { + return ((WebRiskServiceStubSettings) getStubSettings()).searchHashesSettings(); + } + + /** Returns the object with the settings used for calls to createSubmission. */ + public UnaryCallSettings createSubmissionSettings() { + return ((WebRiskServiceStubSettings) getStubSettings()).createSubmissionSettings(); + } + + public static final WebRiskServiceSettings create(WebRiskServiceStubSettings stub) + throws IOException { + return new WebRiskServiceSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return WebRiskServiceStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return WebRiskServiceStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return WebRiskServiceStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return WebRiskServiceStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return WebRiskServiceStubSettings.defaultGrpcTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return WebRiskServiceStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return WebRiskServiceStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected WebRiskServiceSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for WebRiskServiceSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(WebRiskServiceStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(WebRiskServiceStubSettings.newBuilder()); + } + + protected Builder(WebRiskServiceSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(WebRiskServiceStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public WebRiskServiceStubSettings.Builder getStubSettingsBuilder() { + return ((WebRiskServiceStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to computeThreatListDiff. */ + public UnaryCallSettings.Builder + computeThreatListDiffSettings() { + return getStubSettingsBuilder().computeThreatListDiffSettings(); + } + + /** Returns the builder for the settings used for calls to searchUris. */ + public UnaryCallSettings.Builder searchUrisSettings() { + return getStubSettingsBuilder().searchUrisSettings(); + } + + /** Returns the builder for the settings used for calls to searchHashes. */ + public UnaryCallSettings.Builder + searchHashesSettings() { + return getStubSettingsBuilder().searchHashesSettings(); + } + + /** Returns the builder for the settings used for calls to createSubmission. */ + public UnaryCallSettings.Builder + createSubmissionSettings() { + return getStubSettingsBuilder().createSubmissionSettings(); + } + + @Override + public WebRiskServiceSettings build() throws IOException { + return new WebRiskServiceSettings(this); + } + } +} diff --git a/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/package-info.java b/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/package-info.java new file mode 100644 index 00000000..0810626b --- /dev/null +++ b/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/package-info.java @@ -0,0 +1,43 @@ +/* + * 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. + */ + +/** + * A client to Web Risk API. + * + *

The interfaces provided are listed below, along with usage samples. + * + *

==================== WebRiskServiceClient ==================== + * + *

Service Description: Web Risk API defines an interface to detect malicious URLs on your + * website and in client applications. + * + *

Sample for WebRiskServiceClient: + * + *

+ * 
+ * try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
+ *   ThreatType threatType = ThreatType.THREAT_TYPE_UNSPECIFIED;
+ *   ByteString versionToken = ByteString.copyFromUtf8("");
+ *   ComputeThreatListDiffRequest.Constraints constraints = ComputeThreatListDiffRequest.Constraints.newBuilder().build();
+ *   ComputeThreatListDiffResponse response = webRiskServiceClient.computeThreatListDiff(threatType, versionToken, constraints);
+ * }
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +package com.google.cloud.webrisk.v1; + +import javax.annotation.Generated; diff --git a/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/GrpcWebRiskServiceCallableFactory.java b/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/GrpcWebRiskServiceCallableFactory.java new file mode 100644 index 00000000..354a103f --- /dev/null +++ b/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/GrpcWebRiskServiceCallableFactory.java @@ -0,0 +1,115 @@ +/* + * 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. + */ +package com.google.cloud.webrisk.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcCallableFactory; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientStreamingCallable; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.StreamingCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * gRPC callable factory implementation for Web Risk API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class GrpcWebRiskServiceCallableFactory implements GrpcStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + GrpcCallSettings grpcCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + GrpcCallSettings grpcCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable( + grpcCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, batchingCallSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings operationCallSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, operationCallSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } +} diff --git a/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/GrpcWebRiskServiceStub.java b/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/GrpcWebRiskServiceStub.java new file mode 100644 index 00000000..7e68d9cd --- /dev/null +++ b/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/GrpcWebRiskServiceStub.java @@ -0,0 +1,230 @@ +/* + * 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. + */ +package com.google.cloud.webrisk.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +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.RequestParamsExtractor; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.common.collect.ImmutableMap; +import com.google.webrisk.v1.ComputeThreatListDiffRequest; +import com.google.webrisk.v1.ComputeThreatListDiffResponse; +import com.google.webrisk.v1.CreateSubmissionRequest; +import com.google.webrisk.v1.SearchHashesRequest; +import com.google.webrisk.v1.SearchHashesResponse; +import com.google.webrisk.v1.SearchUrisRequest; +import com.google.webrisk.v1.SearchUrisResponse; +import com.google.webrisk.v1.Submission; +import io.grpc.MethodDescriptor; +import io.grpc.protobuf.ProtoUtils; +import java.io.IOException; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * gRPC stub implementation for Web Risk API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class GrpcWebRiskServiceStub extends WebRiskServiceStub { + + private static final MethodDescriptor + computeThreatListDiffMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.webrisk.v1.WebRiskService/ComputeThreatListDiff") + .setRequestMarshaller( + ProtoUtils.marshaller(ComputeThreatListDiffRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ComputeThreatListDiffResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor + searchUrisMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.webrisk.v1.WebRiskService/SearchUris") + .setRequestMarshaller(ProtoUtils.marshaller(SearchUrisRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(SearchUrisResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor + searchHashesMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.webrisk.v1.WebRiskService/SearchHashes") + .setRequestMarshaller(ProtoUtils.marshaller(SearchHashesRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(SearchHashesResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor + createSubmissionMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.webrisk.v1.WebRiskService/CreateSubmission") + .setRequestMarshaller( + ProtoUtils.marshaller(CreateSubmissionRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Submission.getDefaultInstance())) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + computeThreatListDiffCallable; + private final UnaryCallable searchUrisCallable; + private final UnaryCallable searchHashesCallable; + private final UnaryCallable createSubmissionCallable; + + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcWebRiskServiceStub create(WebRiskServiceStubSettings settings) + throws IOException { + return new GrpcWebRiskServiceStub(settings, ClientContext.create(settings)); + } + + public static final GrpcWebRiskServiceStub create(ClientContext clientContext) + throws IOException { + return new GrpcWebRiskServiceStub( + WebRiskServiceStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcWebRiskServiceStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcWebRiskServiceStub( + WebRiskServiceStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcWebRiskServiceStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected GrpcWebRiskServiceStub(WebRiskServiceStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new GrpcWebRiskServiceCallableFactory()); + } + + /** + * Constructs an instance of GrpcWebRiskServiceStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected GrpcWebRiskServiceStub( + WebRiskServiceStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + GrpcCallSettings + computeThreatListDiffTransportSettings = + GrpcCallSettings + .newBuilder() + .setMethodDescriptor(computeThreatListDiffMethodDescriptor) + .build(); + GrpcCallSettings searchUrisTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(searchUrisMethodDescriptor) + .build(); + GrpcCallSettings searchHashesTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(searchHashesMethodDescriptor) + .build(); + GrpcCallSettings createSubmissionTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(createSubmissionMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(CreateSubmissionRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + + this.computeThreatListDiffCallable = + callableFactory.createUnaryCallable( + computeThreatListDiffTransportSettings, + settings.computeThreatListDiffSettings(), + clientContext); + this.searchUrisCallable = + callableFactory.createUnaryCallable( + searchUrisTransportSettings, settings.searchUrisSettings(), clientContext); + this.searchHashesCallable = + callableFactory.createUnaryCallable( + searchHashesTransportSettings, settings.searchHashesSettings(), clientContext); + this.createSubmissionCallable = + callableFactory.createUnaryCallable( + createSubmissionTransportSettings, settings.createSubmissionSettings(), clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public UnaryCallable + computeThreatListDiffCallable() { + return computeThreatListDiffCallable; + } + + public UnaryCallable searchUrisCallable() { + return searchUrisCallable; + } + + public UnaryCallable searchHashesCallable() { + return searchHashesCallable; + } + + public UnaryCallable createSubmissionCallable() { + return createSubmissionCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/WebRiskServiceStub.java b/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/WebRiskServiceStub.java new file mode 100644 index 00000000..dd455cf3 --- /dev/null +++ b/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/WebRiskServiceStub.java @@ -0,0 +1,60 @@ +/* + * 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. + */ +package com.google.cloud.webrisk.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.webrisk.v1.ComputeThreatListDiffRequest; +import com.google.webrisk.v1.ComputeThreatListDiffResponse; +import com.google.webrisk.v1.CreateSubmissionRequest; +import com.google.webrisk.v1.SearchHashesRequest; +import com.google.webrisk.v1.SearchHashesResponse; +import com.google.webrisk.v1.SearchUrisRequest; +import com.google.webrisk.v1.SearchUrisResponse; +import com.google.webrisk.v1.Submission; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for Web Risk API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class WebRiskServiceStub implements BackgroundResource { + + public UnaryCallable + computeThreatListDiffCallable() { + throw new UnsupportedOperationException("Not implemented: computeThreatListDiffCallable()"); + } + + public UnaryCallable searchUrisCallable() { + throw new UnsupportedOperationException("Not implemented: searchUrisCallable()"); + } + + public UnaryCallable searchHashesCallable() { + throw new UnsupportedOperationException("Not implemented: searchHashesCallable()"); + } + + public UnaryCallable createSubmissionCallable() { + throw new UnsupportedOperationException("Not implemented: createSubmissionCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/WebRiskServiceStubSettings.java b/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/WebRiskServiceStubSettings.java new file mode 100644 index 00000000..3efa99ae --- /dev/null +++ b/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/WebRiskServiceStubSettings.java @@ -0,0 +1,357 @@ +/* + * 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. + */ +package com.google.cloud.webrisk.v1.stub; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +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.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.webrisk.v1.ComputeThreatListDiffRequest; +import com.google.webrisk.v1.ComputeThreatListDiffResponse; +import com.google.webrisk.v1.CreateSubmissionRequest; +import com.google.webrisk.v1.SearchHashesRequest; +import com.google.webrisk.v1.SearchHashesResponse; +import com.google.webrisk.v1.SearchUrisRequest; +import com.google.webrisk.v1.SearchUrisResponse; +import com.google.webrisk.v1.Submission; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link WebRiskServiceStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (webrisk.googleapis.com) and default port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of computeThreatListDiff to 30 seconds: + * + *

+ * 
+ * WebRiskServiceStubSettings.Builder webRiskServiceSettingsBuilder =
+ *     WebRiskServiceStubSettings.newBuilder();
+ * webRiskServiceSettingsBuilder
+ *     .computeThreatListDiffSettings()
+ *     .setRetrySettings(
+ *         webRiskServiceSettingsBuilder.computeThreatListDiffSettings().getRetrySettings().toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * WebRiskServiceStubSettings webRiskServiceSettings = webRiskServiceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class WebRiskServiceStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); + + private final UnaryCallSettings + computeThreatListDiffSettings; + private final UnaryCallSettings searchUrisSettings; + private final UnaryCallSettings searchHashesSettings; + private final UnaryCallSettings createSubmissionSettings; + + /** Returns the object with the settings used for calls to computeThreatListDiff. */ + public UnaryCallSettings + computeThreatListDiffSettings() { + return computeThreatListDiffSettings; + } + + /** Returns the object with the settings used for calls to searchUris. */ + public UnaryCallSettings searchUrisSettings() { + return searchUrisSettings; + } + + /** Returns the object with the settings used for calls to searchHashes. */ + public UnaryCallSettings searchHashesSettings() { + return searchHashesSettings; + } + + /** Returns the object with the settings used for calls to createSubmission. */ + public UnaryCallSettings createSubmissionSettings() { + return createSubmissionSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public WebRiskServiceStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcWebRiskServiceStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "webrisk.googleapis.com:443"; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return InstantiatingGrpcChannelProvider.newBuilder() + .setMaxInboundMessageSize(Integer.MAX_VALUE); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultGrpcTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(WebRiskServiceStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected WebRiskServiceStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + computeThreatListDiffSettings = settingsBuilder.computeThreatListDiffSettings().build(); + searchUrisSettings = settingsBuilder.searchUrisSettings().build(); + searchHashesSettings = settingsBuilder.searchHashesSettings().build(); + createSubmissionSettings = settingsBuilder.createSubmissionSettings().build(); + } + + /** Builder for WebRiskServiceStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder< + ComputeThreatListDiffRequest, ComputeThreatListDiffResponse> + computeThreatListDiffSettings; + private final UnaryCallSettings.Builder + searchUrisSettings; + private final UnaryCallSettings.Builder + searchHashesSettings; + private final UnaryCallSettings.Builder + createSubmissionSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + computeThreatListDiffSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + searchUrisSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + searchHashesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + createSubmissionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + computeThreatListDiffSettings, + searchUrisSettings, + searchHashesSettings, + createSubmissionSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .computeThreatListDiffSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .searchUrisSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .searchHashesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .createSubmissionSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(WebRiskServiceStubSettings settings) { + super(settings); + + computeThreatListDiffSettings = settings.computeThreatListDiffSettings.toBuilder(); + searchUrisSettings = settings.searchUrisSettings.toBuilder(); + searchHashesSettings = settings.searchHashesSettings.toBuilder(); + createSubmissionSettings = settings.createSubmissionSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + computeThreatListDiffSettings, + searchUrisSettings, + searchHashesSettings, + createSubmissionSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to computeThreatListDiff. */ + public UnaryCallSettings.Builder + computeThreatListDiffSettings() { + return computeThreatListDiffSettings; + } + + /** Returns the builder for the settings used for calls to searchUris. */ + public UnaryCallSettings.Builder searchUrisSettings() { + return searchUrisSettings; + } + + /** Returns the builder for the settings used for calls to searchHashes. */ + public UnaryCallSettings.Builder + searchHashesSettings() { + return searchHashesSettings; + } + + /** Returns the builder for the settings used for calls to createSubmission. */ + public UnaryCallSettings.Builder + createSubmissionSettings() { + return createSubmissionSettings; + } + + @Override + public WebRiskServiceStubSettings build() throws IOException { + return new WebRiskServiceStubSettings(this); + } + } +} diff --git a/google-cloud-webrisk/src/test/java/com/google/cloud/webrisk/v1/MockWebRiskService.java b/google-cloud-webrisk/src/test/java/com/google/cloud/webrisk/v1/MockWebRiskService.java new file mode 100644 index 00000000..7fd62fab --- /dev/null +++ b/google-cloud-webrisk/src/test/java/com/google/cloud/webrisk/v1/MockWebRiskService.java @@ -0,0 +1,57 @@ +/* + * 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. + */ +package com.google.cloud.webrisk.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.protobuf.AbstractMessage; +import io.grpc.ServerServiceDefinition; +import java.util.List; + +@javax.annotation.Generated("by GAPIC") +@BetaApi +public class MockWebRiskService implements MockGrpcService { + private final MockWebRiskServiceImpl serviceImpl; + + public MockWebRiskService() { + serviceImpl = new MockWebRiskServiceImpl(); + } + + @Override + public List getRequests() { + return serviceImpl.getRequests(); + } + + @Override + public void addResponse(AbstractMessage response) { + serviceImpl.addResponse(response); + } + + @Override + public void addException(Exception exception) { + serviceImpl.addException(exception); + } + + @Override + public ServerServiceDefinition getServiceDefinition() { + return serviceImpl.bindService(); + } + + @Override + public void reset() { + serviceImpl.reset(); + } +} diff --git a/google-cloud-webrisk/src/test/java/com/google/cloud/webrisk/v1/MockWebRiskServiceImpl.java b/google-cloud-webrisk/src/test/java/com/google/cloud/webrisk/v1/MockWebRiskServiceImpl.java new file mode 100644 index 00000000..d96e5423 --- /dev/null +++ b/google-cloud-webrisk/src/test/java/com/google/cloud/webrisk/v1/MockWebRiskServiceImpl.java @@ -0,0 +1,127 @@ +/* + * 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. + */ +package com.google.cloud.webrisk.v1; + +import com.google.api.core.BetaApi; +import com.google.protobuf.AbstractMessage; +import com.google.webrisk.v1.ComputeThreatListDiffRequest; +import com.google.webrisk.v1.ComputeThreatListDiffResponse; +import com.google.webrisk.v1.CreateSubmissionRequest; +import com.google.webrisk.v1.SearchHashesRequest; +import com.google.webrisk.v1.SearchHashesResponse; +import com.google.webrisk.v1.SearchUrisRequest; +import com.google.webrisk.v1.SearchUrisResponse; +import com.google.webrisk.v1.Submission; +import com.google.webrisk.v1.WebRiskServiceGrpc.WebRiskServiceImplBase; +import io.grpc.stub.StreamObserver; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; + +@javax.annotation.Generated("by GAPIC") +@BetaApi +public class MockWebRiskServiceImpl extends WebRiskServiceImplBase { + private List requests; + private Queue responses; + + public MockWebRiskServiceImpl() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + public List getRequests() { + return requests; + } + + public void addResponse(AbstractMessage response) { + responses.add(response); + } + + public void setResponses(List responses) { + this.responses = new LinkedList(responses); + } + + public void addException(Exception exception) { + responses.add(exception); + } + + public void reset() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + @Override + public void computeThreatListDiff( + ComputeThreatListDiffRequest request, + StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof ComputeThreatListDiffResponse) { + requests.add(request); + responseObserver.onNext((ComputeThreatListDiffResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void searchUris( + SearchUrisRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof SearchUrisResponse) { + requests.add(request); + responseObserver.onNext((SearchUrisResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void searchHashes( + SearchHashesRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof SearchHashesResponse) { + requests.add(request); + responseObserver.onNext((SearchHashesResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void createSubmission( + CreateSubmissionRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof Submission) { + requests.add(request); + responseObserver.onNext((Submission) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } +} diff --git a/google-cloud-webrisk/src/test/java/com/google/cloud/webrisk/v1/WebRiskServiceClientTest.java b/google-cloud-webrisk/src/test/java/com/google/cloud/webrisk/v1/WebRiskServiceClientTest.java new file mode 100644 index 00000000..6cf99f4b --- /dev/null +++ b/google-cloud-webrisk/src/test/java/com/google/cloud/webrisk/v1/WebRiskServiceClientTest.java @@ -0,0 +1,262 @@ +/* + * 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. + */ +package com.google.cloud.webrisk.v1; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +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.protobuf.AbstractMessage; +import com.google.protobuf.ByteString; +import com.google.webrisk.v1.ComputeThreatListDiffRequest; +import com.google.webrisk.v1.ComputeThreatListDiffResponse; +import com.google.webrisk.v1.CreateSubmissionRequest; +import com.google.webrisk.v1.ProjectName; +import com.google.webrisk.v1.SearchHashesRequest; +import com.google.webrisk.v1.SearchHashesResponse; +import com.google.webrisk.v1.SearchUrisRequest; +import com.google.webrisk.v1.SearchUrisResponse; +import com.google.webrisk.v1.Submission; +import com.google.webrisk.v1.ThreatType; +import io.grpc.Status; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class WebRiskServiceClientTest { + private static MockWebRiskService mockWebRiskService; + private static MockServiceHelper serviceHelper; + private WebRiskServiceClient client; + private LocalChannelProvider channelProvider; + + @BeforeClass + public static void startStaticServer() { + mockWebRiskService = new MockWebRiskService(); + serviceHelper = + new MockServiceHelper( + UUID.randomUUID().toString(), Arrays.asList(mockWebRiskService)); + serviceHelper.start(); + } + + @AfterClass + public static void stopServer() { + serviceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + serviceHelper.reset(); + channelProvider = serviceHelper.createChannelProvider(); + WebRiskServiceSettings settings = + WebRiskServiceSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = WebRiskServiceClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void computeThreatListDiffTest() { + ByteString newVersionToken = ByteString.copyFromUtf8("115"); + ComputeThreatListDiffResponse expectedResponse = + ComputeThreatListDiffResponse.newBuilder().setNewVersionToken(newVersionToken).build(); + mockWebRiskService.addResponse(expectedResponse); + + ThreatType threatType = ThreatType.THREAT_TYPE_UNSPECIFIED; + ByteString versionToken = ByteString.copyFromUtf8("-46"); + ComputeThreatListDiffRequest.Constraints constraints = + ComputeThreatListDiffRequest.Constraints.newBuilder().build(); + + ComputeThreatListDiffResponse actualResponse = + client.computeThreatListDiff(threatType, versionToken, constraints); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockWebRiskService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ComputeThreatListDiffRequest actualRequest = + (ComputeThreatListDiffRequest) actualRequests.get(0); + + Assert.assertEquals(threatType, actualRequest.getThreatType()); + Assert.assertEquals(versionToken, actualRequest.getVersionToken()); + Assert.assertEquals(constraints, actualRequest.getConstraints()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void computeThreatListDiffExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockWebRiskService.addException(exception); + + try { + ThreatType threatType = ThreatType.THREAT_TYPE_UNSPECIFIED; + ByteString versionToken = ByteString.copyFromUtf8("-46"); + ComputeThreatListDiffRequest.Constraints constraints = + ComputeThreatListDiffRequest.Constraints.newBuilder().build(); + + client.computeThreatListDiff(threatType, versionToken, constraints); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void searchUrisTest() { + SearchUrisResponse expectedResponse = SearchUrisResponse.newBuilder().build(); + mockWebRiskService.addResponse(expectedResponse); + + String uri = "uri116076"; + List threatTypes = new ArrayList<>(); + + SearchUrisResponse actualResponse = client.searchUris(uri, threatTypes); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockWebRiskService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + SearchUrisRequest actualRequest = (SearchUrisRequest) actualRequests.get(0); + + Assert.assertEquals(uri, actualRequest.getUri()); + Assert.assertEquals(threatTypes, actualRequest.getThreatTypesList()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void searchUrisExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockWebRiskService.addException(exception); + + try { + String uri = "uri116076"; + List threatTypes = new ArrayList<>(); + + client.searchUris(uri, threatTypes); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void searchHashesTest() { + SearchHashesResponse expectedResponse = SearchHashesResponse.newBuilder().build(); + mockWebRiskService.addResponse(expectedResponse); + + ByteString hashPrefix = ByteString.copyFromUtf8("-29"); + List threatTypes = new ArrayList<>(); + + SearchHashesResponse actualResponse = client.searchHashes(hashPrefix, threatTypes); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockWebRiskService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + SearchHashesRequest actualRequest = (SearchHashesRequest) actualRequests.get(0); + + Assert.assertEquals(hashPrefix, actualRequest.getHashPrefix()); + Assert.assertEquals(threatTypes, actualRequest.getThreatTypesList()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void searchHashesExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockWebRiskService.addException(exception); + + try { + ByteString hashPrefix = ByteString.copyFromUtf8("-29"); + List threatTypes = new ArrayList<>(); + + client.searchHashes(hashPrefix, threatTypes); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void createSubmissionTest() { + String uri = "uri116076"; + Submission expectedResponse = Submission.newBuilder().setUri(uri).build(); + mockWebRiskService.addResponse(expectedResponse); + + ProjectName parent = ProjectName.of("[PROJECT]"); + Submission submission = Submission.newBuilder().build(); + + Submission actualResponse = client.createSubmission(parent, submission); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockWebRiskService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateSubmissionRequest actualRequest = (CreateSubmissionRequest) actualRequests.get(0); + + Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent())); + Assert.assertEquals(submission, actualRequest.getSubmission()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void createSubmissionExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockWebRiskService.addException(exception); + + try { + ProjectName parent = ProjectName.of("[PROJECT]"); + Submission submission = Submission.newBuilder().build(); + + client.createSubmission(parent, submission); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/grpc-google-cloud-webrisk-v1/pom.xml b/grpc-google-cloud-webrisk-v1/pom.xml new file mode 100644 index 00000000..fc3af14d --- /dev/null +++ b/grpc-google-cloud-webrisk-v1/pom.xml @@ -0,0 +1,56 @@ + + 4.0.0 + com.google.api.grpc + grpc-google-cloud-webrisk-v1 + 0.32.2-SNAPSHOT + grpc-google-cloud-webrisk-v1 + GRPC library for grpc-google-cloud-webrisk-v1 + + com.google.cloud + google-cloud-webrisk-parent + 0.32.2-SNAPSHOT + + + + io.grpc + grpc-api + + + io.grpc + grpc-stub + + + io.grpc + grpc-protobuf + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-cloud-webrisk-v1 + + + com.google.guava + guava + + + + + + java9 + + [9,) + + + + javax.annotation + javax.annotation-api + + + + + \ No newline at end of file diff --git a/grpc-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/WebRiskServiceGrpc.java b/grpc-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/WebRiskServiceGrpc.java new file mode 100644 index 00000000..a1eb73aa --- /dev/null +++ b/grpc-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/WebRiskServiceGrpc.java @@ -0,0 +1,763 @@ +/* + * 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. + */ +package com.google.webrisk.v1; + +import static io.grpc.MethodDescriptor.generateFullMethodName; +import static io.grpc.stub.ClientCalls.asyncUnaryCall; +import static io.grpc.stub.ClientCalls.blockingUnaryCall; +import static io.grpc.stub.ClientCalls.futureUnaryCall; +import static io.grpc.stub.ServerCalls.asyncUnaryCall; +import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall; + +/** + * + * + *
+ * Web Risk API defines an interface to detect malicious URLs on your
+ * website and in client applications.
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler", + comments = "Source: google/cloud/webrisk/v1/webrisk.proto") +public final class WebRiskServiceGrpc { + + private WebRiskServiceGrpc() {} + + public static final String SERVICE_NAME = "google.cloud.webrisk.v1.WebRiskService"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor< + com.google.webrisk.v1.ComputeThreatListDiffRequest, + com.google.webrisk.v1.ComputeThreatListDiffResponse> + getComputeThreatListDiffMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ComputeThreatListDiff", + requestType = com.google.webrisk.v1.ComputeThreatListDiffRequest.class, + responseType = com.google.webrisk.v1.ComputeThreatListDiffResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.webrisk.v1.ComputeThreatListDiffRequest, + com.google.webrisk.v1.ComputeThreatListDiffResponse> + getComputeThreatListDiffMethod() { + io.grpc.MethodDescriptor< + com.google.webrisk.v1.ComputeThreatListDiffRequest, + com.google.webrisk.v1.ComputeThreatListDiffResponse> + getComputeThreatListDiffMethod; + if ((getComputeThreatListDiffMethod = WebRiskServiceGrpc.getComputeThreatListDiffMethod) + == null) { + synchronized (WebRiskServiceGrpc.class) { + if ((getComputeThreatListDiffMethod = WebRiskServiceGrpc.getComputeThreatListDiffMethod) + == null) { + WebRiskServiceGrpc.getComputeThreatListDiffMethod = + getComputeThreatListDiffMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "ComputeThreatListDiff")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.webrisk.v1.ComputeThreatListDiffRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.webrisk.v1.ComputeThreatListDiffResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new WebRiskServiceMethodDescriptorSupplier("ComputeThreatListDiff")) + .build(); + } + } + } + return getComputeThreatListDiffMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.webrisk.v1.SearchUrisRequest, com.google.webrisk.v1.SearchUrisResponse> + getSearchUrisMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "SearchUris", + requestType = com.google.webrisk.v1.SearchUrisRequest.class, + responseType = com.google.webrisk.v1.SearchUrisResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.webrisk.v1.SearchUrisRequest, com.google.webrisk.v1.SearchUrisResponse> + getSearchUrisMethod() { + io.grpc.MethodDescriptor< + com.google.webrisk.v1.SearchUrisRequest, com.google.webrisk.v1.SearchUrisResponse> + getSearchUrisMethod; + if ((getSearchUrisMethod = WebRiskServiceGrpc.getSearchUrisMethod) == null) { + synchronized (WebRiskServiceGrpc.class) { + if ((getSearchUrisMethod = WebRiskServiceGrpc.getSearchUrisMethod) == null) { + WebRiskServiceGrpc.getSearchUrisMethod = + getSearchUrisMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "SearchUris")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.webrisk.v1.SearchUrisRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.webrisk.v1.SearchUrisResponse.getDefaultInstance())) + .setSchemaDescriptor(new WebRiskServiceMethodDescriptorSupplier("SearchUris")) + .build(); + } + } + } + return getSearchUrisMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.webrisk.v1.SearchHashesRequest, com.google.webrisk.v1.SearchHashesResponse> + getSearchHashesMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "SearchHashes", + requestType = com.google.webrisk.v1.SearchHashesRequest.class, + responseType = com.google.webrisk.v1.SearchHashesResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.webrisk.v1.SearchHashesRequest, com.google.webrisk.v1.SearchHashesResponse> + getSearchHashesMethod() { + io.grpc.MethodDescriptor< + com.google.webrisk.v1.SearchHashesRequest, com.google.webrisk.v1.SearchHashesResponse> + getSearchHashesMethod; + if ((getSearchHashesMethod = WebRiskServiceGrpc.getSearchHashesMethod) == null) { + synchronized (WebRiskServiceGrpc.class) { + if ((getSearchHashesMethod = WebRiskServiceGrpc.getSearchHashesMethod) == null) { + WebRiskServiceGrpc.getSearchHashesMethod = + getSearchHashesMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "SearchHashes")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.webrisk.v1.SearchHashesRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.webrisk.v1.SearchHashesResponse.getDefaultInstance())) + .setSchemaDescriptor( + new WebRiskServiceMethodDescriptorSupplier("SearchHashes")) + .build(); + } + } + } + return getSearchHashesMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.webrisk.v1.CreateSubmissionRequest, com.google.webrisk.v1.Submission> + getCreateSubmissionMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "CreateSubmission", + requestType = com.google.webrisk.v1.CreateSubmissionRequest.class, + responseType = com.google.webrisk.v1.Submission.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.webrisk.v1.CreateSubmissionRequest, com.google.webrisk.v1.Submission> + getCreateSubmissionMethod() { + io.grpc.MethodDescriptor< + com.google.webrisk.v1.CreateSubmissionRequest, com.google.webrisk.v1.Submission> + getCreateSubmissionMethod; + if ((getCreateSubmissionMethod = WebRiskServiceGrpc.getCreateSubmissionMethod) == null) { + synchronized (WebRiskServiceGrpc.class) { + if ((getCreateSubmissionMethod = WebRiskServiceGrpc.getCreateSubmissionMethod) == null) { + WebRiskServiceGrpc.getCreateSubmissionMethod = + getCreateSubmissionMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "CreateSubmission")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.webrisk.v1.CreateSubmissionRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.webrisk.v1.Submission.getDefaultInstance())) + .setSchemaDescriptor( + new WebRiskServiceMethodDescriptorSupplier("CreateSubmission")) + .build(); + } + } + } + return getCreateSubmissionMethod; + } + + /** Creates a new async stub that supports all call types for the service */ + public static WebRiskServiceStub newStub(io.grpc.Channel channel) { + return new WebRiskServiceStub(channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static WebRiskServiceBlockingStub newBlockingStub(io.grpc.Channel channel) { + return new WebRiskServiceBlockingStub(channel); + } + + /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ + public static WebRiskServiceFutureStub newFutureStub(io.grpc.Channel channel) { + return new WebRiskServiceFutureStub(channel); + } + + /** + * + * + *
+   * Web Risk API defines an interface to detect malicious URLs on your
+   * website and in client applications.
+   * 
+ */ + public abstract static class WebRiskServiceImplBase implements io.grpc.BindableService { + + /** + * + * + *
+     * 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
+     * empty or excessively out-of-date, a complete snapshot of the database will
+     * 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.
+     * 
+ */ + public void computeThreatListDiff( + com.google.webrisk.v1.ComputeThreatListDiffRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnimplementedUnaryCall(getComputeThreatListDiffMethod(), responseObserver); + } + + /** + * + * + *
+     * This method is used to check whether a URI is on a given threatList.
+     * Multiple threatLists may be searched in a single query.
+     * The response will list all requested threatLists the URI was found to
+     * match. If the URI is not found on any of the requested ThreatList an
+     * empty response will be returned.
+     * 
+ */ + public void searchUris( + com.google.webrisk.v1.SearchUrisRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getSearchUrisMethod(), responseObserver); + } + + /** + * + * + *
+     * Gets the full hashes that match the requested hash prefix.
+     * This is used after a hash prefix is looked up in a threatList
+     * and there is a match. The client side threatList only holds partial hashes
+     * so the client must query this method to determine if there is a full
+     * hash match of a threat.
+     * 
+ */ + public void searchHashes( + com.google.webrisk.v1.SearchHashesRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getSearchHashesMethod(), responseObserver); + } + + /** + * + * + *
+     * Creates a Submission of a URI suspected of containing phishing content to
+     * be reviewed. If the result verifies the existence of malicious phishing
+     * 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
+     * projects with CREATE_SUBMISSION_USERS visibility can use this method.
+     * 
+ */ + public void createSubmission( + com.google.webrisk.v1.CreateSubmissionRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getCreateSubmissionMethod(), responseObserver); + } + + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getComputeThreatListDiffMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.webrisk.v1.ComputeThreatListDiffRequest, + com.google.webrisk.v1.ComputeThreatListDiffResponse>( + this, METHODID_COMPUTE_THREAT_LIST_DIFF))) + .addMethod( + getSearchUrisMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.webrisk.v1.SearchUrisRequest, + com.google.webrisk.v1.SearchUrisResponse>(this, METHODID_SEARCH_URIS))) + .addMethod( + getSearchHashesMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.webrisk.v1.SearchHashesRequest, + com.google.webrisk.v1.SearchHashesResponse>(this, METHODID_SEARCH_HASHES))) + .addMethod( + getCreateSubmissionMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.webrisk.v1.CreateSubmissionRequest, + com.google.webrisk.v1.Submission>(this, METHODID_CREATE_SUBMISSION))) + .build(); + } + } + + /** + * + * + *
+   * Web Risk API defines an interface to detect malicious URLs on your
+   * website and in client applications.
+   * 
+ */ + public static final class WebRiskServiceStub + extends io.grpc.stub.AbstractStub { + private WebRiskServiceStub(io.grpc.Channel channel) { + super(channel); + } + + private WebRiskServiceStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected WebRiskServiceStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new WebRiskServiceStub(channel, callOptions); + } + + /** + * + * + *
+     * 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
+     * empty or excessively out-of-date, a complete snapshot of the database will
+     * 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.
+     * 
+ */ + public void computeThreatListDiff( + com.google.webrisk.v1.ComputeThreatListDiffRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnaryCall( + getChannel().newCall(getComputeThreatListDiffMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * This method is used to check whether a URI is on a given threatList.
+     * Multiple threatLists may be searched in a single query.
+     * The response will list all requested threatLists the URI was found to
+     * match. If the URI is not found on any of the requested ThreatList an
+     * empty response will be returned.
+     * 
+ */ + public void searchUris( + com.google.webrisk.v1.SearchUrisRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getSearchUrisMethod(), getCallOptions()), request, responseObserver); + } + + /** + * + * + *
+     * Gets the full hashes that match the requested hash prefix.
+     * This is used after a hash prefix is looked up in a threatList
+     * and there is a match. The client side threatList only holds partial hashes
+     * so the client must query this method to determine if there is a full
+     * hash match of a threat.
+     * 
+ */ + public void searchHashes( + com.google.webrisk.v1.SearchHashesRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getSearchHashesMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Creates a Submission of a URI suspected of containing phishing content to
+     * be reviewed. If the result verifies the existence of malicious phishing
+     * 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
+     * projects with CREATE_SUBMISSION_USERS visibility can use this method.
+     * 
+ */ + public void createSubmission( + com.google.webrisk.v1.CreateSubmissionRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getCreateSubmissionMethod(), getCallOptions()), + request, + responseObserver); + } + } + + /** + * + * + *
+   * Web Risk API defines an interface to detect malicious URLs on your
+   * website and in client applications.
+   * 
+ */ + public static final class WebRiskServiceBlockingStub + extends io.grpc.stub.AbstractStub { + private WebRiskServiceBlockingStub(io.grpc.Channel channel) { + super(channel); + } + + private WebRiskServiceBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected WebRiskServiceBlockingStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new WebRiskServiceBlockingStub(channel, callOptions); + } + + /** + * + * + *
+     * 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
+     * empty or excessively out-of-date, a complete snapshot of the database will
+     * 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.
+     * 
+ */ + public com.google.webrisk.v1.ComputeThreatListDiffResponse computeThreatListDiff( + com.google.webrisk.v1.ComputeThreatListDiffRequest request) { + return blockingUnaryCall( + getChannel(), getComputeThreatListDiffMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * This method is used to check whether a URI is on a given threatList.
+     * Multiple threatLists may be searched in a single query.
+     * The response will list all requested threatLists the URI was found to
+     * match. If the URI is not found on any of the requested ThreatList an
+     * empty response will be returned.
+     * 
+ */ + public com.google.webrisk.v1.SearchUrisResponse searchUris( + com.google.webrisk.v1.SearchUrisRequest request) { + return blockingUnaryCall(getChannel(), getSearchUrisMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Gets the full hashes that match the requested hash prefix.
+     * This is used after a hash prefix is looked up in a threatList
+     * and there is a match. The client side threatList only holds partial hashes
+     * so the client must query this method to determine if there is a full
+     * hash match of a threat.
+     * 
+ */ + public com.google.webrisk.v1.SearchHashesResponse searchHashes( + com.google.webrisk.v1.SearchHashesRequest request) { + return blockingUnaryCall(getChannel(), getSearchHashesMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Creates a Submission of a URI suspected of containing phishing content to
+     * be reviewed. If the result verifies the existence of malicious phishing
+     * 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
+     * projects with CREATE_SUBMISSION_USERS visibility can use this method.
+     * 
+ */ + public com.google.webrisk.v1.Submission createSubmission( + com.google.webrisk.v1.CreateSubmissionRequest request) { + return blockingUnaryCall( + getChannel(), getCreateSubmissionMethod(), getCallOptions(), request); + } + } + + /** + * + * + *
+   * Web Risk API defines an interface to detect malicious URLs on your
+   * website and in client applications.
+   * 
+ */ + public static final class WebRiskServiceFutureStub + extends io.grpc.stub.AbstractStub { + private WebRiskServiceFutureStub(io.grpc.Channel channel) { + super(channel); + } + + private WebRiskServiceFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected WebRiskServiceFutureStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new WebRiskServiceFutureStub(channel, callOptions); + } + + /** + * + * + *
+     * 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
+     * empty or excessively out-of-date, a complete snapshot of the database will
+     * 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.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.webrisk.v1.ComputeThreatListDiffResponse> + computeThreatListDiff(com.google.webrisk.v1.ComputeThreatListDiffRequest request) { + return futureUnaryCall( + getChannel().newCall(getComputeThreatListDiffMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * This method is used to check whether a URI is on a given threatList.
+     * Multiple threatLists may be searched in a single query.
+     * The response will list all requested threatLists the URI was found to
+     * match. If the URI is not found on any of the requested ThreatList an
+     * empty response will be returned.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.webrisk.v1.SearchUrisResponse> + searchUris(com.google.webrisk.v1.SearchUrisRequest request) { + return futureUnaryCall( + getChannel().newCall(getSearchUrisMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Gets the full hashes that match the requested hash prefix.
+     * This is used after a hash prefix is looked up in a threatList
+     * and there is a match. The client side threatList only holds partial hashes
+     * so the client must query this method to determine if there is a full
+     * hash match of a threat.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.webrisk.v1.SearchHashesResponse> + searchHashes(com.google.webrisk.v1.SearchHashesRequest request) { + return futureUnaryCall( + getChannel().newCall(getSearchHashesMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Creates a Submission of a URI suspected of containing phishing content to
+     * be reviewed. If the result verifies the existence of malicious phishing
+     * 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
+     * projects with CREATE_SUBMISSION_USERS visibility can use this method.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + createSubmission(com.google.webrisk.v1.CreateSubmissionRequest request) { + return futureUnaryCall( + getChannel().newCall(getCreateSubmissionMethod(), 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 class MethodHandlers + implements io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + private final WebRiskServiceImplBase serviceImpl; + private final int methodId; + + MethodHandlers(WebRiskServiceImplBase serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_COMPUTE_THREAT_LIST_DIFF: + serviceImpl.computeThreatListDiff( + (com.google.webrisk.v1.ComputeThreatListDiffRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_SEARCH_URIS: + serviceImpl.searchUris( + (com.google.webrisk.v1.SearchUrisRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_SEARCH_HASHES: + serviceImpl.searchHashes( + (com.google.webrisk.v1.SearchHashesRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_CREATE_SUBMISSION: + serviceImpl.createSubmission( + (com.google.webrisk.v1.CreateSubmissionRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + default: + throw new AssertionError(); + } + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public io.grpc.stub.StreamObserver invoke( + io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + default: + throw new AssertionError(); + } + } + } + + private abstract static class WebRiskServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + WebRiskServiceBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.webrisk.v1.WebRiskProto.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("WebRiskService"); + } + } + + private static final class WebRiskServiceFileDescriptorSupplier + extends WebRiskServiceBaseDescriptorSupplier { + WebRiskServiceFileDescriptorSupplier() {} + } + + private static final class WebRiskServiceMethodDescriptorSupplier + extends WebRiskServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + WebRiskServiceMethodDescriptorSupplier(String methodName) { + this.methodName = methodName; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { + return getServiceDescriptor().findMethodByName(methodName); + } + } + + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (WebRiskServiceGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = + result = + io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new WebRiskServiceFileDescriptorSupplier()) + .addMethod(getComputeThreatListDiffMethod()) + .addMethod(getSearchUrisMethod()) + .addMethod(getSearchHashesMethod()) + .addMethod(getCreateSubmissionMethod()) + .build(); + } + } + } + return result; + } +} diff --git a/pom.xml b/pom.xml index 81b326d1..1a8cd224 100644 --- a/pom.xml +++ b/pom.xml @@ -78,11 +78,21 @@ + + com.google.api.grpc + proto-google-cloud-webrisk-v1 + 0.32.2-SNAPSHOT + com.google.api.grpc proto-google-cloud-webrisk-v1beta1 0.32.2-SNAPSHOT + + com.google.api.grpc + grpc-google-cloud-webrisk-v1 + 0.32.2-SNAPSHOT + com.google.api.grpc grpc-google-cloud-webrisk-v1beta1 @@ -178,7 +188,9 @@ + proto-google-cloud-webrisk-v1 proto-google-cloud-webrisk-v1beta1 + grpc-google-cloud-webrisk-v1 grpc-google-cloud-webrisk-v1beta1 google-cloud-webrisk google-cloud-webrisk-bom diff --git a/proto-google-cloud-webrisk-v1/pom.xml b/proto-google-cloud-webrisk-v1/pom.xml new file mode 100644 index 00000000..cf7c0e10 --- /dev/null +++ b/proto-google-cloud-webrisk-v1/pom.xml @@ -0,0 +1,33 @@ + + 4.0.0 + com.google.api.grpc + proto-google-cloud-webrisk-v1 + 0.32.2-SNAPSHOT + proto-google-cloud-webrisk-v1 + PROTO library for proto-google-cloud-webrisk-v1 + + com.google.cloud + google-cloud-webrisk-parent + 0.32.2-SNAPSHOT + + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + com.google.guava + guava + + + com.google.api + api-common + + + \ No newline at end of file diff --git a/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/CompressionType.java b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/CompressionType.java new file mode 100644 index 00000000..ff23f5eb --- /dev/null +++ b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/CompressionType.java @@ -0,0 +1,172 @@ +/* + * 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; + +/** + * + * + *
+ * The ways in which threat entry sets can be compressed.
+ * 
+ * + * Protobuf enum {@code google.cloud.webrisk.v1.CompressionType} + */ +public enum CompressionType implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+   * Unknown.
+   * 
+ * + * COMPRESSION_TYPE_UNSPECIFIED = 0; + */ + COMPRESSION_TYPE_UNSPECIFIED(0), + /** + * + * + *
+   * Raw, uncompressed data.
+   * 
+ * + * RAW = 1; + */ + RAW(1), + /** + * + * + *
+   * Rice-Golomb encoded data.
+   * 
+ * + * RICE = 2; + */ + RICE(2), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+   * Unknown.
+   * 
+ * + * COMPRESSION_TYPE_UNSPECIFIED = 0; + */ + public static final int COMPRESSION_TYPE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+   * Raw, uncompressed data.
+   * 
+ * + * RAW = 1; + */ + public static final int RAW_VALUE = 1; + /** + * + * + *
+   * Rice-Golomb encoded data.
+   * 
+ * + * RICE = 2; + */ + public static final int RICE_VALUE = 2; + + 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 CompressionType 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 CompressionType forNumber(int value) { + switch (value) { + case 0: + return COMPRESSION_TYPE_UNSPECIFIED; + case 1: + return RAW; + case 2: + return RICE; + 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 CompressionType findValueByNumber(int number) { + return CompressionType.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + 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.WebRiskProto.getDescriptor().getEnumTypes().get(1); + } + + private static final CompressionType[] VALUES = values(); + + public static CompressionType 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 CompressionType(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.webrisk.v1.CompressionType) +} diff --git a/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ComputeThreatListDiffRequest.java b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ComputeThreatListDiffRequest.java new file mode 100644 index 00000000..c3b1c028 --- /dev/null +++ b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ComputeThreatListDiffRequest.java @@ -0,0 +1,2164 @@ +/* + * 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; + +/** + * + * + *
+ * Describes an API diff request.
+ * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.ComputeThreatListDiffRequest} + */ +public final class ComputeThreatListDiffRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.webrisk.v1.ComputeThreatListDiffRequest) + ComputeThreatListDiffRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ComputeThreatListDiffRequest.newBuilder() to construct. + private ComputeThreatListDiffRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ComputeThreatListDiffRequest() { + threatType_ = 0; + versionToken_ = com.google.protobuf.ByteString.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ComputeThreatListDiffRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ComputeThreatListDiffRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + int rawValue = input.readEnum(); + + threatType_ = rawValue; + break; + } + case 18: + { + versionToken_ = input.readBytes(); + break; + } + case 26: + { + com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints.Builder subBuilder = + null; + if (constraints_ != null) { + subBuilder = constraints_.toBuilder(); + } + constraints_ = + input.readMessage( + com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(constraints_); + constraints_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.ComputeThreatListDiffRequest.class, + com.google.webrisk.v1.ComputeThreatListDiffRequest.Builder.class); + } + + public interface ConstraintsOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * The maximum size in number of entries. The diff will not contain more
+     * entries than this value.  This should be a power of 2 between 2**10 and
+     * 2**20.  If zero, no diff size limit is set.
+     * 
+ * + * int32 max_diff_entries = 1; + * + * @return The maxDiffEntries. + */ + int getMaxDiffEntries(); + + /** + * + * + *
+     * Sets the maximum number of entries that the client is willing to have
+     * in the local database. This should be a power of 2 between 2**10 and
+     * 2**20. If zero, no database size limit is set.
+     * 
+ * + * int32 max_database_entries = 2; + * + * @return The maxDatabaseEntries. + */ + int getMaxDatabaseEntries(); + + /** + * + * + *
+     * The compression types supported by the client.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.CompressionType supported_compressions = 3; + * + * @return A list containing the supportedCompressions. + */ + java.util.List getSupportedCompressionsList(); + /** + * + * + *
+     * The compression types supported by the client.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.CompressionType supported_compressions = 3; + * + * @return The count of supportedCompressions. + */ + int getSupportedCompressionsCount(); + /** + * + * + *
+     * The compression types supported by the client.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.CompressionType supported_compressions = 3; + * + * @param index The index of the element to return. + * @return The supportedCompressions at the given index. + */ + com.google.webrisk.v1.CompressionType getSupportedCompressions(int index); + /** + * + * + *
+     * The compression types supported by the client.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.CompressionType supported_compressions = 3; + * + * @return A list containing the enum numeric values on the wire for supportedCompressions. + */ + java.util.List getSupportedCompressionsValueList(); + /** + * + * + *
+     * The compression types supported by the client.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.CompressionType supported_compressions = 3; + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of supportedCompressions at the given index. + */ + int getSupportedCompressionsValue(int index); + } + /** + * + * + *
+   * The constraints for this diff.
+   * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints} + */ + public static final class Constraints extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints) + ConstraintsOrBuilder { + private static final long serialVersionUID = 0L; + // Use Constraints.newBuilder() to construct. + private Constraints(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Constraints() { + supportedCompressions_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Constraints(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Constraints( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + maxDiffEntries_ = input.readInt32(); + break; + } + case 16: + { + maxDatabaseEntries_ = input.readInt32(); + break; + } + case 24: + { + int rawValue = input.readEnum(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + supportedCompressions_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + supportedCompressions_.add(rawValue); + break; + } + case 26: + { + int length = input.readRawVarint32(); + int oldLimit = input.pushLimit(length); + while (input.getBytesUntilLimit() > 0) { + int rawValue = input.readEnum(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + supportedCompressions_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + supportedCompressions_.add(rawValue); + } + input.popLimit(oldLimit); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + supportedCompressions_ = java.util.Collections.unmodifiableList(supportedCompressions_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffRequest_Constraints_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffRequest_Constraints_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints.class, + com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints.Builder.class); + } + + public static final int MAX_DIFF_ENTRIES_FIELD_NUMBER = 1; + private int maxDiffEntries_; + /** + * + * + *
+     * The maximum size in number of entries. The diff will not contain more
+     * entries than this value.  This should be a power of 2 between 2**10 and
+     * 2**20.  If zero, no diff size limit is set.
+     * 
+ * + * int32 max_diff_entries = 1; + * + * @return The maxDiffEntries. + */ + public int getMaxDiffEntries() { + return maxDiffEntries_; + } + + public static final int MAX_DATABASE_ENTRIES_FIELD_NUMBER = 2; + private int maxDatabaseEntries_; + /** + * + * + *
+     * Sets the maximum number of entries that the client is willing to have
+     * in the local database. This should be a power of 2 between 2**10 and
+     * 2**20. If zero, no database size limit is set.
+     * 
+ * + * int32 max_database_entries = 2; + * + * @return The maxDatabaseEntries. + */ + public int getMaxDatabaseEntries() { + return maxDatabaseEntries_; + } + + public static final int SUPPORTED_COMPRESSIONS_FIELD_NUMBER = 3; + private java.util.List supportedCompressions_; + private static final com.google.protobuf.Internal.ListAdapter.Converter< + java.lang.Integer, com.google.webrisk.v1.CompressionType> + supportedCompressions_converter_ = + new com.google.protobuf.Internal.ListAdapter.Converter< + java.lang.Integer, com.google.webrisk.v1.CompressionType>() { + public com.google.webrisk.v1.CompressionType convert(java.lang.Integer from) { + @SuppressWarnings("deprecation") + com.google.webrisk.v1.CompressionType result = + com.google.webrisk.v1.CompressionType.valueOf(from); + return result == null ? com.google.webrisk.v1.CompressionType.UNRECOGNIZED : result; + } + }; + /** + * + * + *
+     * The compression types supported by the client.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.CompressionType supported_compressions = 3; + * + * @return A list containing the supportedCompressions. + */ + public java.util.List getSupportedCompressionsList() { + return new com.google.protobuf.Internal.ListAdapter< + java.lang.Integer, com.google.webrisk.v1.CompressionType>( + supportedCompressions_, supportedCompressions_converter_); + } + /** + * + * + *
+     * The compression types supported by the client.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.CompressionType supported_compressions = 3; + * + * @return The count of supportedCompressions. + */ + public int getSupportedCompressionsCount() { + return supportedCompressions_.size(); + } + /** + * + * + *
+     * The compression types supported by the client.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.CompressionType supported_compressions = 3; + * + * @param index The index of the element to return. + * @return The supportedCompressions at the given index. + */ + public com.google.webrisk.v1.CompressionType getSupportedCompressions(int index) { + return supportedCompressions_converter_.convert(supportedCompressions_.get(index)); + } + /** + * + * + *
+     * The compression types supported by the client.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.CompressionType supported_compressions = 3; + * + * @return A list containing the enum numeric values on the wire for supportedCompressions. + */ + public java.util.List getSupportedCompressionsValueList() { + return supportedCompressions_; + } + /** + * + * + *
+     * The compression types supported by the client.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.CompressionType supported_compressions = 3; + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of supportedCompressions at the given index. + */ + public int getSupportedCompressionsValue(int index) { + return supportedCompressions_.get(index); + } + + private int supportedCompressionsMemoizedSerializedSize; + + 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 (maxDiffEntries_ != 0) { + output.writeInt32(1, maxDiffEntries_); + } + if (maxDatabaseEntries_ != 0) { + output.writeInt32(2, maxDatabaseEntries_); + } + if (getSupportedCompressionsList().size() > 0) { + output.writeUInt32NoTag(26); + output.writeUInt32NoTag(supportedCompressionsMemoizedSerializedSize); + } + for (int i = 0; i < supportedCompressions_.size(); i++) { + output.writeEnumNoTag(supportedCompressions_.get(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (maxDiffEntries_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(1, maxDiffEntries_); + } + if (maxDatabaseEntries_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, maxDatabaseEntries_); + } + { + int dataSize = 0; + for (int i = 0; i < supportedCompressions_.size(); i++) { + dataSize += + com.google.protobuf.CodedOutputStream.computeEnumSizeNoTag( + supportedCompressions_.get(i)); + } + size += dataSize; + if (!getSupportedCompressionsList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(dataSize); + } + supportedCompressionsMemoizedSerializedSize = dataSize; + } + size += unknownFields.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.ComputeThreatListDiffRequest.Constraints)) { + return super.equals(obj); + } + com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints other = + (com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints) obj; + + if (getMaxDiffEntries() != other.getMaxDiffEntries()) return false; + if (getMaxDatabaseEntries() != other.getMaxDatabaseEntries()) return false; + if (!supportedCompressions_.equals(other.supportedCompressions_)) return false; + if (!unknownFields.equals(other.unknownFields)) 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) + MAX_DIFF_ENTRIES_FIELD_NUMBER; + hash = (53 * hash) + getMaxDiffEntries(); + hash = (37 * hash) + MAX_DATABASE_ENTRIES_FIELD_NUMBER; + hash = (53 * hash) + getMaxDatabaseEntries(); + if (getSupportedCompressionsCount() > 0) { + hash = (37 * hash) + SUPPORTED_COMPRESSIONS_FIELD_NUMBER; + hash = (53 * hash) + supportedCompressions_.hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints 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.ComputeThreatListDiffRequest.Constraints parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints 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.ComputeThreatListDiffRequest.Constraints parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints 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.ComputeThreatListDiffRequest.Constraints parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints 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.ComputeThreatListDiffRequest.Constraints parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints 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.ComputeThreatListDiffRequest.Constraints 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; + } + /** + * + * + *
+     * The constraints for this diff.
+     * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints) + com.google.webrisk.v1.ComputeThreatListDiffRequest.ConstraintsOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffRequest_Constraints_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffRequest_Constraints_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints.class, + com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints.Builder.class); + } + + // Construct using com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + maxDiffEntries_ = 0; + + maxDatabaseEntries_ = 0; + + supportedCompressions_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffRequest_Constraints_descriptor; + } + + @java.lang.Override + public com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints + getDefaultInstanceForType() { + return com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints.getDefaultInstance(); + } + + @java.lang.Override + public com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints build() { + com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints buildPartial() { + com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints result = + new com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints(this); + int from_bitField0_ = bitField0_; + result.maxDiffEntries_ = maxDiffEntries_; + result.maxDatabaseEntries_ = maxDatabaseEntries_; + if (((bitField0_ & 0x00000001) != 0)) { + supportedCompressions_ = java.util.Collections.unmodifiableList(supportedCompressions_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.supportedCompressions_ = supportedCompressions_; + onBuilt(); + return result; + } + + @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.ComputeThreatListDiffRequest.Constraints) { + return mergeFrom((com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints other) { + if (other + == com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints.getDefaultInstance()) + return this; + if (other.getMaxDiffEntries() != 0) { + setMaxDiffEntries(other.getMaxDiffEntries()); + } + if (other.getMaxDatabaseEntries() != 0) { + setMaxDatabaseEntries(other.getMaxDatabaseEntries()); + } + if (!other.supportedCompressions_.isEmpty()) { + if (supportedCompressions_.isEmpty()) { + supportedCompressions_ = other.supportedCompressions_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureSupportedCompressionsIsMutable(); + supportedCompressions_.addAll(other.supportedCompressions_); + } + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints) + e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private int maxDiffEntries_; + /** + * + * + *
+       * The maximum size in number of entries. The diff will not contain more
+       * entries than this value.  This should be a power of 2 between 2**10 and
+       * 2**20.  If zero, no diff size limit is set.
+       * 
+ * + * int32 max_diff_entries = 1; + * + * @return The maxDiffEntries. + */ + public int getMaxDiffEntries() { + return maxDiffEntries_; + } + /** + * + * + *
+       * The maximum size in number of entries. The diff will not contain more
+       * entries than this value.  This should be a power of 2 between 2**10 and
+       * 2**20.  If zero, no diff size limit is set.
+       * 
+ * + * int32 max_diff_entries = 1; + * + * @param value The maxDiffEntries to set. + * @return This builder for chaining. + */ + public Builder setMaxDiffEntries(int value) { + + maxDiffEntries_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * The maximum size in number of entries. The diff will not contain more
+       * entries than this value.  This should be a power of 2 between 2**10 and
+       * 2**20.  If zero, no diff size limit is set.
+       * 
+ * + * int32 max_diff_entries = 1; + * + * @return This builder for chaining. + */ + public Builder clearMaxDiffEntries() { + + maxDiffEntries_ = 0; + onChanged(); + return this; + } + + private int maxDatabaseEntries_; + /** + * + * + *
+       * Sets the maximum number of entries that the client is willing to have
+       * in the local database. This should be a power of 2 between 2**10 and
+       * 2**20. If zero, no database size limit is set.
+       * 
+ * + * int32 max_database_entries = 2; + * + * @return The maxDatabaseEntries. + */ + public int getMaxDatabaseEntries() { + return maxDatabaseEntries_; + } + /** + * + * + *
+       * Sets the maximum number of entries that the client is willing to have
+       * in the local database. This should be a power of 2 between 2**10 and
+       * 2**20. If zero, no database size limit is set.
+       * 
+ * + * int32 max_database_entries = 2; + * + * @param value The maxDatabaseEntries to set. + * @return This builder for chaining. + */ + public Builder setMaxDatabaseEntries(int value) { + + maxDatabaseEntries_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * Sets the maximum number of entries that the client is willing to have
+       * in the local database. This should be a power of 2 between 2**10 and
+       * 2**20. If zero, no database size limit is set.
+       * 
+ * + * int32 max_database_entries = 2; + * + * @return This builder for chaining. + */ + public Builder clearMaxDatabaseEntries() { + + maxDatabaseEntries_ = 0; + onChanged(); + return this; + } + + private java.util.List supportedCompressions_ = + java.util.Collections.emptyList(); + + private void ensureSupportedCompressionsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + supportedCompressions_ = + new java.util.ArrayList(supportedCompressions_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+       * The compression types supported by the client.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.CompressionType supported_compressions = 3; + * + * @return A list containing the supportedCompressions. + */ + public java.util.List getSupportedCompressionsList() { + return new com.google.protobuf.Internal.ListAdapter< + java.lang.Integer, com.google.webrisk.v1.CompressionType>( + supportedCompressions_, supportedCompressions_converter_); + } + /** + * + * + *
+       * The compression types supported by the client.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.CompressionType supported_compressions = 3; + * + * @return The count of supportedCompressions. + */ + public int getSupportedCompressionsCount() { + return supportedCompressions_.size(); + } + /** + * + * + *
+       * The compression types supported by the client.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.CompressionType supported_compressions = 3; + * + * @param index The index of the element to return. + * @return The supportedCompressions at the given index. + */ + public com.google.webrisk.v1.CompressionType getSupportedCompressions(int index) { + return supportedCompressions_converter_.convert(supportedCompressions_.get(index)); + } + /** + * + * + *
+       * The compression types supported by the client.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.CompressionType supported_compressions = 3; + * + * @param index The index to set the value at. + * @param value The supportedCompressions to set. + * @return This builder for chaining. + */ + public Builder setSupportedCompressions( + int index, com.google.webrisk.v1.CompressionType value) { + if (value == null) { + throw new NullPointerException(); + } + ensureSupportedCompressionsIsMutable(); + supportedCompressions_.set(index, value.getNumber()); + onChanged(); + return this; + } + /** + * + * + *
+       * The compression types supported by the client.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.CompressionType supported_compressions = 3; + * + * @param value The supportedCompressions to add. + * @return This builder for chaining. + */ + public Builder addSupportedCompressions(com.google.webrisk.v1.CompressionType value) { + if (value == null) { + throw new NullPointerException(); + } + ensureSupportedCompressionsIsMutable(); + supportedCompressions_.add(value.getNumber()); + onChanged(); + return this; + } + /** + * + * + *
+       * The compression types supported by the client.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.CompressionType supported_compressions = 3; + * + * @param values The supportedCompressions to add. + * @return This builder for chaining. + */ + public Builder addAllSupportedCompressions( + java.lang.Iterable values) { + ensureSupportedCompressionsIsMutable(); + for (com.google.webrisk.v1.CompressionType value : values) { + supportedCompressions_.add(value.getNumber()); + } + onChanged(); + return this; + } + /** + * + * + *
+       * The compression types supported by the client.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.CompressionType supported_compressions = 3; + * + * @return This builder for chaining. + */ + public Builder clearSupportedCompressions() { + supportedCompressions_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+       * The compression types supported by the client.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.CompressionType supported_compressions = 3; + * + * @return A list containing the enum numeric values on the wire for supportedCompressions. + */ + public java.util.List getSupportedCompressionsValueList() { + return java.util.Collections.unmodifiableList(supportedCompressions_); + } + /** + * + * + *
+       * The compression types supported by the client.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.CompressionType supported_compressions = 3; + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of supportedCompressions at the given index. + */ + public int getSupportedCompressionsValue(int index) { + return supportedCompressions_.get(index); + } + /** + * + * + *
+       * The compression types supported by the client.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.CompressionType supported_compressions = 3; + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of supportedCompressions at the given index. + * @return This builder for chaining. + */ + public Builder setSupportedCompressionsValue(int index, int value) { + ensureSupportedCompressionsIsMutable(); + supportedCompressions_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+       * The compression types supported by the client.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.CompressionType supported_compressions = 3; + * + * @param value The enum numeric value on the wire for supportedCompressions to add. + * @return This builder for chaining. + */ + public Builder addSupportedCompressionsValue(int value) { + ensureSupportedCompressionsIsMutable(); + supportedCompressions_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+       * The compression types supported by the client.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.CompressionType supported_compressions = 3; + * + * @param values The enum numeric values on the wire for supportedCompressions to add. + * @return This builder for chaining. + */ + public Builder addAllSupportedCompressionsValue( + java.lang.Iterable values) { + ensureSupportedCompressionsIsMutable(); + for (int value : values) { + supportedCompressions_.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.ComputeThreatListDiffRequest.Constraints) + } + + // @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints) + private static final com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints(); + } + + public static com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Constraints parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Constraints(input, extensionRegistry); + } + }; + + 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.ComputeThreatListDiffRequest.Constraints + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public static final int THREAT_TYPE_FIELD_NUMBER = 1; + private int threatType_; + /** + * + * + *
+   * Required. The threat list to update. Only a single ThreatType should be specified.
+   * 
+ * + * + * .google.cloud.webrisk.v1.ThreatType threat_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The enum numeric value on the wire for threatType. + */ + public int getThreatTypeValue() { + return threatType_; + } + /** + * + * + *
+   * Required. The threat list to update. Only a single ThreatType should be specified.
+   * 
+ * + * + * .google.cloud.webrisk.v1.ThreatType threat_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The threatType. + */ + public com.google.webrisk.v1.ThreatType getThreatType() { + @SuppressWarnings("deprecation") + com.google.webrisk.v1.ThreatType result = com.google.webrisk.v1.ThreatType.valueOf(threatType_); + return result == null ? com.google.webrisk.v1.ThreatType.UNRECOGNIZED : result; + } + + public static final int VERSION_TOKEN_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString versionToken_; + /** + * + * + *
+   * The current version token of the client for the requested list (the
+   * client version that was received from the last successful diff).
+   * If the client does not have a version token (this is the first time calling
+   * ComputeThreatListDiff), this may be left empty and a full database
+   * snapshot will be returned.
+   * 
+ * + * bytes version_token = 2; + * + * @return The versionToken. + */ + public com.google.protobuf.ByteString getVersionToken() { + return versionToken_; + } + + public static final int CONSTRAINTS_FIELD_NUMBER = 3; + private com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints constraints_; + /** + * + * + *
+   * Required. The constraints associated with this request.
+   * 
+ * + * + * .google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints constraints = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the constraints field is set. + */ + public boolean hasConstraints() { + return constraints_ != null; + } + /** + * + * + *
+   * Required. The constraints associated with this request.
+   * 
+ * + * + * .google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints constraints = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The constraints. + */ + public com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints getConstraints() { + return constraints_ == null + ? com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints.getDefaultInstance() + : constraints_; + } + /** + * + * + *
+   * Required. The constraints associated with this request.
+   * 
+ * + * + * .google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints constraints = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.webrisk.v1.ComputeThreatListDiffRequest.ConstraintsOrBuilder + getConstraintsOrBuilder() { + return getConstraints(); + } + + 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 (threatType_ != com.google.webrisk.v1.ThreatType.THREAT_TYPE_UNSPECIFIED.getNumber()) { + output.writeEnum(1, threatType_); + } + if (!versionToken_.isEmpty()) { + output.writeBytes(2, versionToken_); + } + if (constraints_ != null) { + output.writeMessage(3, getConstraints()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (threatType_ != com.google.webrisk.v1.ThreatType.THREAT_TYPE_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, threatType_); + } + if (!versionToken_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream.computeBytesSize(2, versionToken_); + } + if (constraints_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getConstraints()); + } + size += unknownFields.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.ComputeThreatListDiffRequest)) { + return super.equals(obj); + } + com.google.webrisk.v1.ComputeThreatListDiffRequest other = + (com.google.webrisk.v1.ComputeThreatListDiffRequest) obj; + + if (threatType_ != other.threatType_) return false; + if (!getVersionToken().equals(other.getVersionToken())) return false; + if (hasConstraints() != other.hasConstraints()) return false; + if (hasConstraints()) { + if (!getConstraints().equals(other.getConstraints())) return false; + } + if (!unknownFields.equals(other.unknownFields)) 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) + THREAT_TYPE_FIELD_NUMBER; + hash = (53 * hash) + threatType_; + hash = (37 * hash) + VERSION_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getVersionToken().hashCode(); + if (hasConstraints()) { + hash = (37 * hash) + CONSTRAINTS_FIELD_NUMBER; + hash = (53 * hash) + getConstraints().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.webrisk.v1.ComputeThreatListDiffRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.ComputeThreatListDiffRequest 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.ComputeThreatListDiffRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.ComputeThreatListDiffRequest 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.ComputeThreatListDiffRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.ComputeThreatListDiffRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.ComputeThreatListDiffRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.ComputeThreatListDiffRequest 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.ComputeThreatListDiffRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.ComputeThreatListDiffRequest 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.ComputeThreatListDiffRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.ComputeThreatListDiffRequest 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.ComputeThreatListDiffRequest 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; + } + /** + * + * + *
+   * Describes an API diff request.
+   * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.ComputeThreatListDiffRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.webrisk.v1.ComputeThreatListDiffRequest) + com.google.webrisk.v1.ComputeThreatListDiffRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.ComputeThreatListDiffRequest.class, + com.google.webrisk.v1.ComputeThreatListDiffRequest.Builder.class); + } + + // Construct using com.google.webrisk.v1.ComputeThreatListDiffRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + threatType_ = 0; + + versionToken_ = com.google.protobuf.ByteString.EMPTY; + + if (constraintsBuilder_ == null) { + constraints_ = null; + } else { + constraints_ = null; + constraintsBuilder_ = 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_ComputeThreatListDiffRequest_descriptor; + } + + @java.lang.Override + public com.google.webrisk.v1.ComputeThreatListDiffRequest getDefaultInstanceForType() { + return com.google.webrisk.v1.ComputeThreatListDiffRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.webrisk.v1.ComputeThreatListDiffRequest build() { + com.google.webrisk.v1.ComputeThreatListDiffRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.webrisk.v1.ComputeThreatListDiffRequest buildPartial() { + com.google.webrisk.v1.ComputeThreatListDiffRequest result = + new com.google.webrisk.v1.ComputeThreatListDiffRequest(this); + result.threatType_ = threatType_; + result.versionToken_ = versionToken_; + if (constraintsBuilder_ == null) { + result.constraints_ = constraints_; + } else { + result.constraints_ = constraintsBuilder_.build(); + } + onBuilt(); + return result; + } + + @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.ComputeThreatListDiffRequest) { + return mergeFrom((com.google.webrisk.v1.ComputeThreatListDiffRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.webrisk.v1.ComputeThreatListDiffRequest other) { + if (other == com.google.webrisk.v1.ComputeThreatListDiffRequest.getDefaultInstance()) + return this; + if (other.threatType_ != 0) { + setThreatTypeValue(other.getThreatTypeValue()); + } + if (other.getVersionToken() != com.google.protobuf.ByteString.EMPTY) { + setVersionToken(other.getVersionToken()); + } + if (other.hasConstraints()) { + mergeConstraints(other.getConstraints()); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.webrisk.v1.ComputeThreatListDiffRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.webrisk.v1.ComputeThreatListDiffRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int threatType_ = 0; + /** + * + * + *
+     * Required. The threat list to update. Only a single ThreatType should be specified.
+     * 
+ * + * + * .google.cloud.webrisk.v1.ThreatType threat_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The enum numeric value on the wire for threatType. + */ + public int getThreatTypeValue() { + return threatType_; + } + /** + * + * + *
+     * Required. The threat list to update. Only a single ThreatType should be specified.
+     * 
+ * + * + * .google.cloud.webrisk.v1.ThreatType threat_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @param value The enum numeric value on the wire for threatType to set. + * @return This builder for chaining. + */ + public Builder setThreatTypeValue(int value) { + threatType_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The threat list to update. Only a single ThreatType should be specified.
+     * 
+ * + * + * .google.cloud.webrisk.v1.ThreatType threat_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The threatType. + */ + public com.google.webrisk.v1.ThreatType getThreatType() { + @SuppressWarnings("deprecation") + com.google.webrisk.v1.ThreatType result = + com.google.webrisk.v1.ThreatType.valueOf(threatType_); + return result == null ? com.google.webrisk.v1.ThreatType.UNRECOGNIZED : result; + } + /** + * + * + *
+     * Required. The threat list to update. Only a single ThreatType should be specified.
+     * 
+ * + * + * .google.cloud.webrisk.v1.ThreatType threat_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @param value The threatType to set. + * @return This builder for chaining. + */ + public Builder setThreatType(com.google.webrisk.v1.ThreatType value) { + if (value == null) { + throw new NullPointerException(); + } + + threatType_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The threat list to update. Only a single ThreatType should be specified.
+     * 
+ * + * + * .google.cloud.webrisk.v1.ThreatType threat_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return This builder for chaining. + */ + public Builder clearThreatType() { + + threatType_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.ByteString versionToken_ = com.google.protobuf.ByteString.EMPTY; + /** + * + * + *
+     * The current version token of the client for the requested list (the
+     * client version that was received from the last successful diff).
+     * If the client does not have a version token (this is the first time calling
+     * ComputeThreatListDiff), this may be left empty and a full database
+     * snapshot will be returned.
+     * 
+ * + * bytes version_token = 2; + * + * @return The versionToken. + */ + public com.google.protobuf.ByteString getVersionToken() { + return versionToken_; + } + /** + * + * + *
+     * The current version token of the client for the requested list (the
+     * client version that was received from the last successful diff).
+     * If the client does not have a version token (this is the first time calling
+     * ComputeThreatListDiff), this may be left empty and a full database
+     * snapshot will be returned.
+     * 
+ * + * bytes version_token = 2; + * + * @param value The versionToken to set. + * @return This builder for chaining. + */ + public Builder setVersionToken(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + + versionToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The current version token of the client for the requested list (the
+     * client version that was received from the last successful diff).
+     * If the client does not have a version token (this is the first time calling
+     * ComputeThreatListDiff), this may be left empty and a full database
+     * snapshot will be returned.
+     * 
+ * + * bytes version_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearVersionToken() { + + versionToken_ = getDefaultInstance().getVersionToken(); + onChanged(); + return this; + } + + private com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints constraints_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints, + com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints.Builder, + com.google.webrisk.v1.ComputeThreatListDiffRequest.ConstraintsOrBuilder> + constraintsBuilder_; + /** + * + * + *
+     * Required. The constraints associated with this request.
+     * 
+ * + * + * .google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints constraints = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the constraints field is set. + */ + public boolean hasConstraints() { + return constraintsBuilder_ != null || constraints_ != null; + } + /** + * + * + *
+     * Required. The constraints associated with this request.
+     * 
+ * + * + * .google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints constraints = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The constraints. + */ + public com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints getConstraints() { + if (constraintsBuilder_ == null) { + return constraints_ == null + ? com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints.getDefaultInstance() + : constraints_; + } else { + return constraintsBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The constraints associated with this request.
+     * 
+ * + * + * .google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints constraints = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setConstraints( + com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints value) { + if (constraintsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + constraints_ = value; + onChanged(); + } else { + constraintsBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The constraints associated with this request.
+     * 
+ * + * + * .google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints constraints = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setConstraints( + com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints.Builder builderForValue) { + if (constraintsBuilder_ == null) { + constraints_ = builderForValue.build(); + onChanged(); + } else { + constraintsBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The constraints associated with this request.
+     * 
+ * + * + * .google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints constraints = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeConstraints( + com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints value) { + if (constraintsBuilder_ == null) { + if (constraints_ != null) { + constraints_ = + com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints.newBuilder( + constraints_) + .mergeFrom(value) + .buildPartial(); + } else { + constraints_ = value; + } + onChanged(); + } else { + constraintsBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The constraints associated with this request.
+     * 
+ * + * + * .google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints constraints = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearConstraints() { + if (constraintsBuilder_ == null) { + constraints_ = null; + onChanged(); + } else { + constraints_ = null; + constraintsBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The constraints associated with this request.
+     * 
+ * + * + * .google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints constraints = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints.Builder + getConstraintsBuilder() { + + onChanged(); + return getConstraintsFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The constraints associated with this request.
+     * 
+ * + * + * .google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints constraints = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.webrisk.v1.ComputeThreatListDiffRequest.ConstraintsOrBuilder + getConstraintsOrBuilder() { + if (constraintsBuilder_ != null) { + return constraintsBuilder_.getMessageOrBuilder(); + } else { + return constraints_ == null + ? com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints.getDefaultInstance() + : constraints_; + } + } + /** + * + * + *
+     * Required. The constraints associated with this request.
+     * 
+ * + * + * .google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints constraints = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints, + com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints.Builder, + com.google.webrisk.v1.ComputeThreatListDiffRequest.ConstraintsOrBuilder> + getConstraintsFieldBuilder() { + if (constraintsBuilder_ == null) { + constraintsBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints, + com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints.Builder, + com.google.webrisk.v1.ComputeThreatListDiffRequest.ConstraintsOrBuilder>( + getConstraints(), getParentForChildren(), isClean()); + constraints_ = null; + } + return constraintsBuilder_; + } + + @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.ComputeThreatListDiffRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.ComputeThreatListDiffRequest) + private static final com.google.webrisk.v1.ComputeThreatListDiffRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.webrisk.v1.ComputeThreatListDiffRequest(); + } + + public static com.google.webrisk.v1.ComputeThreatListDiffRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ComputeThreatListDiffRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ComputeThreatListDiffRequest(input, extensionRegistry); + } + }; + + 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.ComputeThreatListDiffRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ComputeThreatListDiffRequestOrBuilder.java b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ComputeThreatListDiffRequestOrBuilder.java new file mode 100644 index 00000000..2551fd3a --- /dev/null +++ b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ComputeThreatListDiffRequestOrBuilder.java @@ -0,0 +1,112 @@ +/* + * 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 ComputeThreatListDiffRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.webrisk.v1.ComputeThreatListDiffRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The threat list to update. Only a single ThreatType should be specified.
+   * 
+ * + * + * .google.cloud.webrisk.v1.ThreatType threat_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The enum numeric value on the wire for threatType. + */ + int getThreatTypeValue(); + /** + * + * + *
+   * Required. The threat list to update. Only a single ThreatType should be specified.
+   * 
+ * + * + * .google.cloud.webrisk.v1.ThreatType threat_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The threatType. + */ + com.google.webrisk.v1.ThreatType getThreatType(); + + /** + * + * + *
+   * The current version token of the client for the requested list (the
+   * client version that was received from the last successful diff).
+   * If the client does not have a version token (this is the first time calling
+   * ComputeThreatListDiff), this may be left empty and a full database
+   * snapshot will be returned.
+   * 
+ * + * bytes version_token = 2; + * + * @return The versionToken. + */ + com.google.protobuf.ByteString getVersionToken(); + + /** + * + * + *
+   * Required. The constraints associated with this request.
+   * 
+ * + * + * .google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints constraints = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the constraints field is set. + */ + boolean hasConstraints(); + /** + * + * + *
+   * Required. The constraints associated with this request.
+   * 
+ * + * + * .google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints constraints = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The constraints. + */ + com.google.webrisk.v1.ComputeThreatListDiffRequest.Constraints getConstraints(); + /** + * + * + *
+   * Required. The constraints associated with this request.
+   * 
+ * + * + * .google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints constraints = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.webrisk.v1.ComputeThreatListDiffRequest.ConstraintsOrBuilder getConstraintsOrBuilder(); +} diff --git a/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ComputeThreatListDiffResponse.java b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ComputeThreatListDiffResponse.java new file mode 100644 index 00000000..84aad17f --- /dev/null +++ b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ComputeThreatListDiffResponse.java @@ -0,0 +1,2622 @@ +/* + * 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; + +/** Protobuf type {@code google.cloud.webrisk.v1.ComputeThreatListDiffResponse} */ +public final class ComputeThreatListDiffResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.webrisk.v1.ComputeThreatListDiffResponse) + ComputeThreatListDiffResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ComputeThreatListDiffResponse.newBuilder() to construct. + private ComputeThreatListDiffResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ComputeThreatListDiffResponse() { + responseType_ = 0; + newVersionToken_ = com.google.protobuf.ByteString.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ComputeThreatListDiffResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ComputeThreatListDiffResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 18: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (recommendedNextDiff_ != null) { + subBuilder = recommendedNextDiff_.toBuilder(); + } + recommendedNextDiff_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(recommendedNextDiff_); + recommendedNextDiff_ = subBuilder.buildPartial(); + } + + break; + } + case 32: + { + int rawValue = input.readEnum(); + + responseType_ = rawValue; + break; + } + case 42: + { + com.google.webrisk.v1.ThreatEntryAdditions.Builder subBuilder = null; + if (additions_ != null) { + subBuilder = additions_.toBuilder(); + } + additions_ = + input.readMessage( + com.google.webrisk.v1.ThreatEntryAdditions.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(additions_); + additions_ = subBuilder.buildPartial(); + } + + break; + } + case 50: + { + com.google.webrisk.v1.ThreatEntryRemovals.Builder subBuilder = null; + if (removals_ != null) { + subBuilder = removals_.toBuilder(); + } + removals_ = + input.readMessage( + com.google.webrisk.v1.ThreatEntryRemovals.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(removals_); + removals_ = subBuilder.buildPartial(); + } + + break; + } + case 58: + { + newVersionToken_ = input.readBytes(); + break; + } + case 66: + { + com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum.Builder subBuilder = + null; + if (checksum_ != null) { + subBuilder = checksum_.toBuilder(); + } + checksum_ = + input.readMessage( + com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(checksum_); + checksum_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.ComputeThreatListDiffResponse.class, + com.google.webrisk.v1.ComputeThreatListDiffResponse.Builder.class); + } + + /** + * + * + *
+   * The type of response sent to the client.
+   * 
+ * + * Protobuf enum {@code google.cloud.webrisk.v1.ComputeThreatListDiffResponse.ResponseType} + */ + public enum ResponseType implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Unknown.
+     * 
+ * + * RESPONSE_TYPE_UNSPECIFIED = 0; + */ + RESPONSE_TYPE_UNSPECIFIED(0), + /** + * + * + *
+     * Partial updates are applied to the client's existing local database.
+     * 
+ * + * DIFF = 1; + */ + DIFF(1), + /** + * + * + *
+     * Full updates resets the client's entire local database. This means
+     * that either the client had no state, was seriously out-of-date,
+     * or the client is believed to be corrupt.
+     * 
+ * + * RESET = 2; + */ + RESET(2), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Unknown.
+     * 
+ * + * RESPONSE_TYPE_UNSPECIFIED = 0; + */ + public static final int RESPONSE_TYPE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * Partial updates are applied to the client's existing local database.
+     * 
+ * + * DIFF = 1; + */ + public static final int DIFF_VALUE = 1; + /** + * + * + *
+     * Full updates resets the client's entire local database. This means
+     * that either the client had no state, was seriously out-of-date,
+     * or the client is believed to be corrupt.
+     * 
+ * + * RESET = 2; + */ + public static final int RESET_VALUE = 2; + + 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 ResponseType 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 ResponseType forNumber(int value) { + switch (value) { + case 0: + return RESPONSE_TYPE_UNSPECIFIED; + case 1: + return DIFF; + case 2: + return RESET; + 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 ResponseType findValueByNumber(int number) { + return ResponseType.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + 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.ComputeThreatListDiffResponse.getDescriptor() + .getEnumTypes() + .get(0); + } + + private static final ResponseType[] VALUES = values(); + + public static ResponseType 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 ResponseType(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.webrisk.v1.ComputeThreatListDiffResponse.ResponseType) + } + + public interface ChecksumOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * The SHA256 hash of the client state; that is, of the sorted list of all
+     * hashes present in the database.
+     * 
+ * + * bytes sha256 = 1; + * + * @return The sha256. + */ + com.google.protobuf.ByteString getSha256(); + } + /** + * + * + *
+   * The expected state of a client's local database.
+   * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum} + */ + public static final class Checksum extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum) + ChecksumOrBuilder { + private static final long serialVersionUID = 0L; + // Use Checksum.newBuilder() to construct. + private Checksum(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Checksum() { + sha256_ = com.google.protobuf.ByteString.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Checksum(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Checksum( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + sha256_ = input.readBytes(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffResponse_Checksum_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffResponse_Checksum_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum.class, + com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum.Builder.class); + } + + public static final int SHA256_FIELD_NUMBER = 1; + private com.google.protobuf.ByteString sha256_; + /** + * + * + *
+     * The SHA256 hash of the client state; that is, of the sorted list of all
+     * hashes present in the database.
+     * 
+ * + * bytes sha256 = 1; + * + * @return The sha256. + */ + public com.google.protobuf.ByteString getSha256() { + return sha256_; + } + + 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 (!sha256_.isEmpty()) { + output.writeBytes(1, sha256_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!sha256_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream.computeBytesSize(1, sha256_); + } + size += unknownFields.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.ComputeThreatListDiffResponse.Checksum)) { + return super.equals(obj); + } + com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum other = + (com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum) obj; + + if (!getSha256().equals(other.getSha256())) return false; + if (!unknownFields.equals(other.unknownFields)) 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) + SHA256_FIELD_NUMBER; + hash = (53 * hash) + getSha256().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum 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.ComputeThreatListDiffResponse.Checksum parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum 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.ComputeThreatListDiffResponse.Checksum parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum 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.ComputeThreatListDiffResponse.Checksum parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum 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.ComputeThreatListDiffResponse.Checksum parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum 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.ComputeThreatListDiffResponse.Checksum 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; + } + /** + * + * + *
+     * The expected state of a client's local database.
+     * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum) + com.google.webrisk.v1.ComputeThreatListDiffResponse.ChecksumOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffResponse_Checksum_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffResponse_Checksum_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum.class, + com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum.Builder.class); + } + + // Construct using com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + sha256_ = com.google.protobuf.ByteString.EMPTY; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffResponse_Checksum_descriptor; + } + + @java.lang.Override + public com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum + getDefaultInstanceForType() { + return com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum.getDefaultInstance(); + } + + @java.lang.Override + public com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum build() { + com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum buildPartial() { + com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum result = + new com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum(this); + result.sha256_ = sha256_; + onBuilt(); + return result; + } + + @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.ComputeThreatListDiffResponse.Checksum) { + return mergeFrom((com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum other) { + if (other + == com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum.getDefaultInstance()) + return this; + if (other.getSha256() != com.google.protobuf.ByteString.EMPTY) { + setSha256(other.getSha256()); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum) + e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.protobuf.ByteString sha256_ = com.google.protobuf.ByteString.EMPTY; + /** + * + * + *
+       * The SHA256 hash of the client state; that is, of the sorted list of all
+       * hashes present in the database.
+       * 
+ * + * bytes sha256 = 1; + * + * @return The sha256. + */ + public com.google.protobuf.ByteString getSha256() { + return sha256_; + } + /** + * + * + *
+       * The SHA256 hash of the client state; that is, of the sorted list of all
+       * hashes present in the database.
+       * 
+ * + * bytes sha256 = 1; + * + * @param value The sha256 to set. + * @return This builder for chaining. + */ + public Builder setSha256(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + + sha256_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * The SHA256 hash of the client state; that is, of the sorted list of all
+       * hashes present in the database.
+       * 
+ * + * bytes sha256 = 1; + * + * @return This builder for chaining. + */ + public Builder clearSha256() { + + sha256_ = getDefaultInstance().getSha256(); + 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.ComputeThreatListDiffResponse.Checksum) + } + + // @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum) + private static final com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum(); + } + + public static com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Checksum parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Checksum(input, extensionRegistry); + } + }; + + 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.ComputeThreatListDiffResponse.Checksum + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public static final int RESPONSE_TYPE_FIELD_NUMBER = 4; + private int responseType_; + /** + * + * + *
+   * The type of response. This may indicate that an action must be taken by the
+   * client when the response is received.
+   * 
+ * + * .google.cloud.webrisk.v1.ComputeThreatListDiffResponse.ResponseType response_type = 4; + * + * + * @return The enum numeric value on the wire for responseType. + */ + public int getResponseTypeValue() { + return responseType_; + } + /** + * + * + *
+   * The type of response. This may indicate that an action must be taken by the
+   * client when the response is received.
+   * 
+ * + * .google.cloud.webrisk.v1.ComputeThreatListDiffResponse.ResponseType response_type = 4; + * + * + * @return The responseType. + */ + public com.google.webrisk.v1.ComputeThreatListDiffResponse.ResponseType getResponseType() { + @SuppressWarnings("deprecation") + com.google.webrisk.v1.ComputeThreatListDiffResponse.ResponseType result = + com.google.webrisk.v1.ComputeThreatListDiffResponse.ResponseType.valueOf(responseType_); + return result == null + ? com.google.webrisk.v1.ComputeThreatListDiffResponse.ResponseType.UNRECOGNIZED + : result; + } + + public static final int ADDITIONS_FIELD_NUMBER = 5; + private com.google.webrisk.v1.ThreatEntryAdditions additions_; + /** + * + * + *
+   * A set of entries to add to a local threat type's list.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatEntryAdditions additions = 5; + * + * @return Whether the additions field is set. + */ + public boolean hasAdditions() { + return additions_ != null; + } + /** + * + * + *
+   * A set of entries to add to a local threat type's list.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatEntryAdditions additions = 5; + * + * @return The additions. + */ + public com.google.webrisk.v1.ThreatEntryAdditions getAdditions() { + return additions_ == null + ? com.google.webrisk.v1.ThreatEntryAdditions.getDefaultInstance() + : additions_; + } + /** + * + * + *
+   * A set of entries to add to a local threat type's list.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatEntryAdditions additions = 5; + */ + public com.google.webrisk.v1.ThreatEntryAdditionsOrBuilder getAdditionsOrBuilder() { + return getAdditions(); + } + + public static final int REMOVALS_FIELD_NUMBER = 6; + private com.google.webrisk.v1.ThreatEntryRemovals removals_; + /** + * + * + *
+   * A set of entries to remove from a local threat type's list.
+   * This field may be empty.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatEntryRemovals removals = 6; + * + * @return Whether the removals field is set. + */ + public boolean hasRemovals() { + return removals_ != null; + } + /** + * + * + *
+   * A set of entries to remove from a local threat type's list.
+   * This field may be empty.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatEntryRemovals removals = 6; + * + * @return The removals. + */ + public com.google.webrisk.v1.ThreatEntryRemovals getRemovals() { + return removals_ == null + ? com.google.webrisk.v1.ThreatEntryRemovals.getDefaultInstance() + : removals_; + } + /** + * + * + *
+   * A set of entries to remove from a local threat type's list.
+   * This field may be empty.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatEntryRemovals removals = 6; + */ + public com.google.webrisk.v1.ThreatEntryRemovalsOrBuilder getRemovalsOrBuilder() { + return getRemovals(); + } + + public static final int NEW_VERSION_TOKEN_FIELD_NUMBER = 7; + private com.google.protobuf.ByteString newVersionToken_; + /** + * + * + *
+   * The new opaque client version token. This should be retained by the client
+   * and passed into the next call of ComputeThreatListDiff as 'version_token'.
+   * A separate version token should be stored and used for each threatList.
+   * 
+ * + * bytes new_version_token = 7; + * + * @return The newVersionToken. + */ + public com.google.protobuf.ByteString getNewVersionToken() { + return newVersionToken_; + } + + public static final int CHECKSUM_FIELD_NUMBER = 8; + private com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum checksum_; + /** + * + * + *
+   * The expected SHA256 hash of the client state; that is, of the sorted list
+   * of all hashes present in the database after applying the provided diff.
+   * If the client state doesn't match the expected state, the client must
+   * discard this diff and retry later.
+   * 
+ * + * .google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum checksum = 8; + * + * @return Whether the checksum field is set. + */ + public boolean hasChecksum() { + return checksum_ != null; + } + /** + * + * + *
+   * The expected SHA256 hash of the client state; that is, of the sorted list
+   * of all hashes present in the database after applying the provided diff.
+   * If the client state doesn't match the expected state, the client must
+   * discard this diff and retry later.
+   * 
+ * + * .google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum checksum = 8; + * + * @return The checksum. + */ + public com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum getChecksum() { + return checksum_ == null + ? com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum.getDefaultInstance() + : checksum_; + } + /** + * + * + *
+   * The expected SHA256 hash of the client state; that is, of the sorted list
+   * of all hashes present in the database after applying the provided diff.
+   * If the client state doesn't match the expected state, the client must
+   * discard this diff and retry later.
+   * 
+ * + * .google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum checksum = 8; + */ + public com.google.webrisk.v1.ComputeThreatListDiffResponse.ChecksumOrBuilder + getChecksumOrBuilder() { + return getChecksum(); + } + + public static final int RECOMMENDED_NEXT_DIFF_FIELD_NUMBER = 2; + private com.google.protobuf.Timestamp recommendedNextDiff_; + /** + * + * + *
+   * The soonest the client should wait before issuing any diff
+   * request. Querying sooner is unlikely to produce a meaningful diff.
+   * Waiting longer is acceptable considering the use case.
+   * If this field is not set clients may update as soon as they want.
+   * 
+ * + * .google.protobuf.Timestamp recommended_next_diff = 2; + * + * @return Whether the recommendedNextDiff field is set. + */ + public boolean hasRecommendedNextDiff() { + return recommendedNextDiff_ != null; + } + /** + * + * + *
+   * The soonest the client should wait before issuing any diff
+   * request. Querying sooner is unlikely to produce a meaningful diff.
+   * Waiting longer is acceptable considering the use case.
+   * If this field is not set clients may update as soon as they want.
+   * 
+ * + * .google.protobuf.Timestamp recommended_next_diff = 2; + * + * @return The recommendedNextDiff. + */ + public com.google.protobuf.Timestamp getRecommendedNextDiff() { + return recommendedNextDiff_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : recommendedNextDiff_; + } + /** + * + * + *
+   * The soonest the client should wait before issuing any diff
+   * request. Querying sooner is unlikely to produce a meaningful diff.
+   * Waiting longer is acceptable considering the use case.
+   * If this field is not set clients may update as soon as they want.
+   * 
+ * + * .google.protobuf.Timestamp recommended_next_diff = 2; + */ + public com.google.protobuf.TimestampOrBuilder getRecommendedNextDiffOrBuilder() { + return getRecommendedNextDiff(); + } + + 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 (recommendedNextDiff_ != null) { + output.writeMessage(2, getRecommendedNextDiff()); + } + if (responseType_ + != com.google.webrisk.v1.ComputeThreatListDiffResponse.ResponseType + .RESPONSE_TYPE_UNSPECIFIED + .getNumber()) { + output.writeEnum(4, responseType_); + } + if (additions_ != null) { + output.writeMessage(5, getAdditions()); + } + if (removals_ != null) { + output.writeMessage(6, getRemovals()); + } + if (!newVersionToken_.isEmpty()) { + output.writeBytes(7, newVersionToken_); + } + if (checksum_ != null) { + output.writeMessage(8, getChecksum()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (recommendedNextDiff_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getRecommendedNextDiff()); + } + if (responseType_ + != com.google.webrisk.v1.ComputeThreatListDiffResponse.ResponseType + .RESPONSE_TYPE_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(4, responseType_); + } + if (additions_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, getAdditions()); + } + if (removals_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getRemovals()); + } + if (!newVersionToken_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream.computeBytesSize(7, newVersionToken_); + } + if (checksum_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, getChecksum()); + } + size += unknownFields.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.ComputeThreatListDiffResponse)) { + return super.equals(obj); + } + com.google.webrisk.v1.ComputeThreatListDiffResponse other = + (com.google.webrisk.v1.ComputeThreatListDiffResponse) obj; + + if (responseType_ != other.responseType_) return false; + if (hasAdditions() != other.hasAdditions()) return false; + if (hasAdditions()) { + if (!getAdditions().equals(other.getAdditions())) return false; + } + if (hasRemovals() != other.hasRemovals()) return false; + if (hasRemovals()) { + if (!getRemovals().equals(other.getRemovals())) return false; + } + if (!getNewVersionToken().equals(other.getNewVersionToken())) return false; + if (hasChecksum() != other.hasChecksum()) return false; + if (hasChecksum()) { + if (!getChecksum().equals(other.getChecksum())) return false; + } + if (hasRecommendedNextDiff() != other.hasRecommendedNextDiff()) return false; + if (hasRecommendedNextDiff()) { + if (!getRecommendedNextDiff().equals(other.getRecommendedNextDiff())) return false; + } + if (!unknownFields.equals(other.unknownFields)) 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) + RESPONSE_TYPE_FIELD_NUMBER; + hash = (53 * hash) + responseType_; + if (hasAdditions()) { + hash = (37 * hash) + ADDITIONS_FIELD_NUMBER; + hash = (53 * hash) + getAdditions().hashCode(); + } + if (hasRemovals()) { + hash = (37 * hash) + REMOVALS_FIELD_NUMBER; + hash = (53 * hash) + getRemovals().hashCode(); + } + hash = (37 * hash) + NEW_VERSION_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNewVersionToken().hashCode(); + if (hasChecksum()) { + hash = (37 * hash) + CHECKSUM_FIELD_NUMBER; + hash = (53 * hash) + getChecksum().hashCode(); + } + if (hasRecommendedNextDiff()) { + hash = (37 * hash) + RECOMMENDED_NEXT_DIFF_FIELD_NUMBER; + hash = (53 * hash) + getRecommendedNextDiff().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.webrisk.v1.ComputeThreatListDiffResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.ComputeThreatListDiffResponse 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.ComputeThreatListDiffResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.ComputeThreatListDiffResponse 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.ComputeThreatListDiffResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.ComputeThreatListDiffResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.ComputeThreatListDiffResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.ComputeThreatListDiffResponse 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.ComputeThreatListDiffResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.ComputeThreatListDiffResponse 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.ComputeThreatListDiffResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.ComputeThreatListDiffResponse 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.ComputeThreatListDiffResponse 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; + } + /** Protobuf type {@code google.cloud.webrisk.v1.ComputeThreatListDiffResponse} */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.webrisk.v1.ComputeThreatListDiffResponse) + com.google.webrisk.v1.ComputeThreatListDiffResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.ComputeThreatListDiffResponse.class, + com.google.webrisk.v1.ComputeThreatListDiffResponse.Builder.class); + } + + // Construct using com.google.webrisk.v1.ComputeThreatListDiffResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + responseType_ = 0; + + if (additionsBuilder_ == null) { + additions_ = null; + } else { + additions_ = null; + additionsBuilder_ = null; + } + if (removalsBuilder_ == null) { + removals_ = null; + } else { + removals_ = null; + removalsBuilder_ = null; + } + newVersionToken_ = com.google.protobuf.ByteString.EMPTY; + + if (checksumBuilder_ == null) { + checksum_ = null; + } else { + checksum_ = null; + checksumBuilder_ = null; + } + if (recommendedNextDiffBuilder_ == null) { + recommendedNextDiff_ = null; + } else { + recommendedNextDiff_ = null; + recommendedNextDiffBuilder_ = 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_ComputeThreatListDiffResponse_descriptor; + } + + @java.lang.Override + public com.google.webrisk.v1.ComputeThreatListDiffResponse getDefaultInstanceForType() { + return com.google.webrisk.v1.ComputeThreatListDiffResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.webrisk.v1.ComputeThreatListDiffResponse build() { + com.google.webrisk.v1.ComputeThreatListDiffResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.webrisk.v1.ComputeThreatListDiffResponse buildPartial() { + com.google.webrisk.v1.ComputeThreatListDiffResponse result = + new com.google.webrisk.v1.ComputeThreatListDiffResponse(this); + result.responseType_ = responseType_; + if (additionsBuilder_ == null) { + result.additions_ = additions_; + } else { + result.additions_ = additionsBuilder_.build(); + } + if (removalsBuilder_ == null) { + result.removals_ = removals_; + } else { + result.removals_ = removalsBuilder_.build(); + } + result.newVersionToken_ = newVersionToken_; + if (checksumBuilder_ == null) { + result.checksum_ = checksum_; + } else { + result.checksum_ = checksumBuilder_.build(); + } + if (recommendedNextDiffBuilder_ == null) { + result.recommendedNextDiff_ = recommendedNextDiff_; + } else { + result.recommendedNextDiff_ = recommendedNextDiffBuilder_.build(); + } + onBuilt(); + return result; + } + + @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.ComputeThreatListDiffResponse) { + return mergeFrom((com.google.webrisk.v1.ComputeThreatListDiffResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.webrisk.v1.ComputeThreatListDiffResponse other) { + if (other == com.google.webrisk.v1.ComputeThreatListDiffResponse.getDefaultInstance()) + return this; + if (other.responseType_ != 0) { + setResponseTypeValue(other.getResponseTypeValue()); + } + if (other.hasAdditions()) { + mergeAdditions(other.getAdditions()); + } + if (other.hasRemovals()) { + mergeRemovals(other.getRemovals()); + } + if (other.getNewVersionToken() != com.google.protobuf.ByteString.EMPTY) { + setNewVersionToken(other.getNewVersionToken()); + } + if (other.hasChecksum()) { + mergeChecksum(other.getChecksum()); + } + if (other.hasRecommendedNextDiff()) { + mergeRecommendedNextDiff(other.getRecommendedNextDiff()); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.webrisk.v1.ComputeThreatListDiffResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.webrisk.v1.ComputeThreatListDiffResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int responseType_ = 0; + /** + * + * + *
+     * The type of response. This may indicate that an action must be taken by the
+     * client when the response is received.
+     * 
+ * + * .google.cloud.webrisk.v1.ComputeThreatListDiffResponse.ResponseType response_type = 4; + * + * + * @return The enum numeric value on the wire for responseType. + */ + public int getResponseTypeValue() { + return responseType_; + } + /** + * + * + *
+     * The type of response. This may indicate that an action must be taken by the
+     * client when the response is received.
+     * 
+ * + * .google.cloud.webrisk.v1.ComputeThreatListDiffResponse.ResponseType response_type = 4; + * + * + * @param value The enum numeric value on the wire for responseType to set. + * @return This builder for chaining. + */ + public Builder setResponseTypeValue(int value) { + responseType_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The type of response. This may indicate that an action must be taken by the
+     * client when the response is received.
+     * 
+ * + * .google.cloud.webrisk.v1.ComputeThreatListDiffResponse.ResponseType response_type = 4; + * + * + * @return The responseType. + */ + public com.google.webrisk.v1.ComputeThreatListDiffResponse.ResponseType getResponseType() { + @SuppressWarnings("deprecation") + com.google.webrisk.v1.ComputeThreatListDiffResponse.ResponseType result = + com.google.webrisk.v1.ComputeThreatListDiffResponse.ResponseType.valueOf(responseType_); + return result == null + ? com.google.webrisk.v1.ComputeThreatListDiffResponse.ResponseType.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * The type of response. This may indicate that an action must be taken by the
+     * client when the response is received.
+     * 
+ * + * .google.cloud.webrisk.v1.ComputeThreatListDiffResponse.ResponseType response_type = 4; + * + * + * @param value The responseType to set. + * @return This builder for chaining. + */ + public Builder setResponseType( + com.google.webrisk.v1.ComputeThreatListDiffResponse.ResponseType value) { + if (value == null) { + throw new NullPointerException(); + } + + responseType_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * The type of response. This may indicate that an action must be taken by the
+     * client when the response is received.
+     * 
+ * + * .google.cloud.webrisk.v1.ComputeThreatListDiffResponse.ResponseType response_type = 4; + * + * + * @return This builder for chaining. + */ + public Builder clearResponseType() { + + responseType_ = 0; + onChanged(); + return this; + } + + private com.google.webrisk.v1.ThreatEntryAdditions additions_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.ThreatEntryAdditions, + com.google.webrisk.v1.ThreatEntryAdditions.Builder, + com.google.webrisk.v1.ThreatEntryAdditionsOrBuilder> + additionsBuilder_; + /** + * + * + *
+     * A set of entries to add to a local threat type's list.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatEntryAdditions additions = 5; + * + * @return Whether the additions field is set. + */ + public boolean hasAdditions() { + return additionsBuilder_ != null || additions_ != null; + } + /** + * + * + *
+     * A set of entries to add to a local threat type's list.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatEntryAdditions additions = 5; + * + * @return The additions. + */ + public com.google.webrisk.v1.ThreatEntryAdditions getAdditions() { + if (additionsBuilder_ == null) { + return additions_ == null + ? com.google.webrisk.v1.ThreatEntryAdditions.getDefaultInstance() + : additions_; + } else { + return additionsBuilder_.getMessage(); + } + } + /** + * + * + *
+     * A set of entries to add to a local threat type's list.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatEntryAdditions additions = 5; + */ + public Builder setAdditions(com.google.webrisk.v1.ThreatEntryAdditions value) { + if (additionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + additions_ = value; + onChanged(); + } else { + additionsBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * A set of entries to add to a local threat type's list.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatEntryAdditions additions = 5; + */ + public Builder setAdditions( + com.google.webrisk.v1.ThreatEntryAdditions.Builder builderForValue) { + if (additionsBuilder_ == null) { + additions_ = builderForValue.build(); + onChanged(); + } else { + additionsBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * A set of entries to add to a local threat type's list.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatEntryAdditions additions = 5; + */ + public Builder mergeAdditions(com.google.webrisk.v1.ThreatEntryAdditions value) { + if (additionsBuilder_ == null) { + if (additions_ != null) { + additions_ = + com.google.webrisk.v1.ThreatEntryAdditions.newBuilder(additions_) + .mergeFrom(value) + .buildPartial(); + } else { + additions_ = value; + } + onChanged(); + } else { + additionsBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * A set of entries to add to a local threat type's list.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatEntryAdditions additions = 5; + */ + public Builder clearAdditions() { + if (additionsBuilder_ == null) { + additions_ = null; + onChanged(); + } else { + additions_ = null; + additionsBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * A set of entries to add to a local threat type's list.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatEntryAdditions additions = 5; + */ + public com.google.webrisk.v1.ThreatEntryAdditions.Builder getAdditionsBuilder() { + + onChanged(); + return getAdditionsFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * A set of entries to add to a local threat type's list.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatEntryAdditions additions = 5; + */ + public com.google.webrisk.v1.ThreatEntryAdditionsOrBuilder getAdditionsOrBuilder() { + if (additionsBuilder_ != null) { + return additionsBuilder_.getMessageOrBuilder(); + } else { + return additions_ == null + ? com.google.webrisk.v1.ThreatEntryAdditions.getDefaultInstance() + : additions_; + } + } + /** + * + * + *
+     * A set of entries to add to a local threat type's list.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatEntryAdditions additions = 5; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.ThreatEntryAdditions, + com.google.webrisk.v1.ThreatEntryAdditions.Builder, + com.google.webrisk.v1.ThreatEntryAdditionsOrBuilder> + getAdditionsFieldBuilder() { + if (additionsBuilder_ == null) { + additionsBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.ThreatEntryAdditions, + com.google.webrisk.v1.ThreatEntryAdditions.Builder, + com.google.webrisk.v1.ThreatEntryAdditionsOrBuilder>( + getAdditions(), getParentForChildren(), isClean()); + additions_ = null; + } + return additionsBuilder_; + } + + private com.google.webrisk.v1.ThreatEntryRemovals removals_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.ThreatEntryRemovals, + com.google.webrisk.v1.ThreatEntryRemovals.Builder, + com.google.webrisk.v1.ThreatEntryRemovalsOrBuilder> + removalsBuilder_; + /** + * + * + *
+     * A set of entries to remove from a local threat type's list.
+     * This field may be empty.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatEntryRemovals removals = 6; + * + * @return Whether the removals field is set. + */ + public boolean hasRemovals() { + return removalsBuilder_ != null || removals_ != null; + } + /** + * + * + *
+     * A set of entries to remove from a local threat type's list.
+     * This field may be empty.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatEntryRemovals removals = 6; + * + * @return The removals. + */ + public com.google.webrisk.v1.ThreatEntryRemovals getRemovals() { + if (removalsBuilder_ == null) { + return removals_ == null + ? com.google.webrisk.v1.ThreatEntryRemovals.getDefaultInstance() + : removals_; + } else { + return removalsBuilder_.getMessage(); + } + } + /** + * + * + *
+     * A set of entries to remove from a local threat type's list.
+     * This field may be empty.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatEntryRemovals removals = 6; + */ + public Builder setRemovals(com.google.webrisk.v1.ThreatEntryRemovals value) { + if (removalsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + removals_ = value; + onChanged(); + } else { + removalsBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * A set of entries to remove from a local threat type's list.
+     * This field may be empty.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatEntryRemovals removals = 6; + */ + public Builder setRemovals(com.google.webrisk.v1.ThreatEntryRemovals.Builder builderForValue) { + if (removalsBuilder_ == null) { + removals_ = builderForValue.build(); + onChanged(); + } else { + removalsBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * A set of entries to remove from a local threat type's list.
+     * This field may be empty.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatEntryRemovals removals = 6; + */ + public Builder mergeRemovals(com.google.webrisk.v1.ThreatEntryRemovals value) { + if (removalsBuilder_ == null) { + if (removals_ != null) { + removals_ = + com.google.webrisk.v1.ThreatEntryRemovals.newBuilder(removals_) + .mergeFrom(value) + .buildPartial(); + } else { + removals_ = value; + } + onChanged(); + } else { + removalsBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * A set of entries to remove from a local threat type's list.
+     * This field may be empty.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatEntryRemovals removals = 6; + */ + public Builder clearRemovals() { + if (removalsBuilder_ == null) { + removals_ = null; + onChanged(); + } else { + removals_ = null; + removalsBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * A set of entries to remove from a local threat type's list.
+     * This field may be empty.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatEntryRemovals removals = 6; + */ + public com.google.webrisk.v1.ThreatEntryRemovals.Builder getRemovalsBuilder() { + + onChanged(); + return getRemovalsFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * A set of entries to remove from a local threat type's list.
+     * This field may be empty.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatEntryRemovals removals = 6; + */ + public com.google.webrisk.v1.ThreatEntryRemovalsOrBuilder getRemovalsOrBuilder() { + if (removalsBuilder_ != null) { + return removalsBuilder_.getMessageOrBuilder(); + } else { + return removals_ == null + ? com.google.webrisk.v1.ThreatEntryRemovals.getDefaultInstance() + : removals_; + } + } + /** + * + * + *
+     * A set of entries to remove from a local threat type's list.
+     * This field may be empty.
+     * 
+ * + * .google.cloud.webrisk.v1.ThreatEntryRemovals removals = 6; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.ThreatEntryRemovals, + com.google.webrisk.v1.ThreatEntryRemovals.Builder, + com.google.webrisk.v1.ThreatEntryRemovalsOrBuilder> + getRemovalsFieldBuilder() { + if (removalsBuilder_ == null) { + removalsBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.ThreatEntryRemovals, + com.google.webrisk.v1.ThreatEntryRemovals.Builder, + com.google.webrisk.v1.ThreatEntryRemovalsOrBuilder>( + getRemovals(), getParentForChildren(), isClean()); + removals_ = null; + } + return removalsBuilder_; + } + + private com.google.protobuf.ByteString newVersionToken_ = com.google.protobuf.ByteString.EMPTY; + /** + * + * + *
+     * The new opaque client version token. This should be retained by the client
+     * and passed into the next call of ComputeThreatListDiff as 'version_token'.
+     * A separate version token should be stored and used for each threatList.
+     * 
+ * + * bytes new_version_token = 7; + * + * @return The newVersionToken. + */ + public com.google.protobuf.ByteString getNewVersionToken() { + return newVersionToken_; + } + /** + * + * + *
+     * The new opaque client version token. This should be retained by the client
+     * and passed into the next call of ComputeThreatListDiff as 'version_token'.
+     * A separate version token should be stored and used for each threatList.
+     * 
+ * + * bytes new_version_token = 7; + * + * @param value The newVersionToken to set. + * @return This builder for chaining. + */ + public Builder setNewVersionToken(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + + newVersionToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The new opaque client version token. This should be retained by the client
+     * and passed into the next call of ComputeThreatListDiff as 'version_token'.
+     * A separate version token should be stored and used for each threatList.
+     * 
+ * + * bytes new_version_token = 7; + * + * @return This builder for chaining. + */ + public Builder clearNewVersionToken() { + + newVersionToken_ = getDefaultInstance().getNewVersionToken(); + onChanged(); + return this; + } + + private com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum checksum_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum, + com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum.Builder, + com.google.webrisk.v1.ComputeThreatListDiffResponse.ChecksumOrBuilder> + checksumBuilder_; + /** + * + * + *
+     * The expected SHA256 hash of the client state; that is, of the sorted list
+     * of all hashes present in the database after applying the provided diff.
+     * If the client state doesn't match the expected state, the client must
+     * discard this diff and retry later.
+     * 
+ * + * .google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum checksum = 8; + * + * @return Whether the checksum field is set. + */ + public boolean hasChecksum() { + return checksumBuilder_ != null || checksum_ != null; + } + /** + * + * + *
+     * The expected SHA256 hash of the client state; that is, of the sorted list
+     * of all hashes present in the database after applying the provided diff.
+     * If the client state doesn't match the expected state, the client must
+     * discard this diff and retry later.
+     * 
+ * + * .google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum checksum = 8; + * + * @return The checksum. + */ + public com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum getChecksum() { + if (checksumBuilder_ == null) { + return checksum_ == null + ? com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum.getDefaultInstance() + : checksum_; + } else { + return checksumBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The expected SHA256 hash of the client state; that is, of the sorted list
+     * of all hashes present in the database after applying the provided diff.
+     * If the client state doesn't match the expected state, the client must
+     * discard this diff and retry later.
+     * 
+ * + * .google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum checksum = 8; + */ + public Builder setChecksum(com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum value) { + if (checksumBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + checksum_ = value; + onChanged(); + } else { + checksumBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The expected SHA256 hash of the client state; that is, of the sorted list
+     * of all hashes present in the database after applying the provided diff.
+     * If the client state doesn't match the expected state, the client must
+     * discard this diff and retry later.
+     * 
+ * + * .google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum checksum = 8; + */ + public Builder setChecksum( + com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum.Builder builderForValue) { + if (checksumBuilder_ == null) { + checksum_ = builderForValue.build(); + onChanged(); + } else { + checksumBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The expected SHA256 hash of the client state; that is, of the sorted list
+     * of all hashes present in the database after applying the provided diff.
+     * If the client state doesn't match the expected state, the client must
+     * discard this diff and retry later.
+     * 
+ * + * .google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum checksum = 8; + */ + public Builder mergeChecksum( + com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum value) { + if (checksumBuilder_ == null) { + if (checksum_ != null) { + checksum_ = + com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum.newBuilder(checksum_) + .mergeFrom(value) + .buildPartial(); + } else { + checksum_ = value; + } + onChanged(); + } else { + checksumBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The expected SHA256 hash of the client state; that is, of the sorted list
+     * of all hashes present in the database after applying the provided diff.
+     * If the client state doesn't match the expected state, the client must
+     * discard this diff and retry later.
+     * 
+ * + * .google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum checksum = 8; + */ + public Builder clearChecksum() { + if (checksumBuilder_ == null) { + checksum_ = null; + onChanged(); + } else { + checksum_ = null; + checksumBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The expected SHA256 hash of the client state; that is, of the sorted list
+     * of all hashes present in the database after applying the provided diff.
+     * If the client state doesn't match the expected state, the client must
+     * discard this diff and retry later.
+     * 
+ * + * .google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum checksum = 8; + */ + public com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum.Builder + getChecksumBuilder() { + + onChanged(); + return getChecksumFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The expected SHA256 hash of the client state; that is, of the sorted list
+     * of all hashes present in the database after applying the provided diff.
+     * If the client state doesn't match the expected state, the client must
+     * discard this diff and retry later.
+     * 
+ * + * .google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum checksum = 8; + */ + public com.google.webrisk.v1.ComputeThreatListDiffResponse.ChecksumOrBuilder + getChecksumOrBuilder() { + if (checksumBuilder_ != null) { + return checksumBuilder_.getMessageOrBuilder(); + } else { + return checksum_ == null + ? com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum.getDefaultInstance() + : checksum_; + } + } + /** + * + * + *
+     * The expected SHA256 hash of the client state; that is, of the sorted list
+     * of all hashes present in the database after applying the provided diff.
+     * If the client state doesn't match the expected state, the client must
+     * discard this diff and retry later.
+     * 
+ * + * .google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum checksum = 8; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum, + com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum.Builder, + com.google.webrisk.v1.ComputeThreatListDiffResponse.ChecksumOrBuilder> + getChecksumFieldBuilder() { + if (checksumBuilder_ == null) { + checksumBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum, + com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum.Builder, + com.google.webrisk.v1.ComputeThreatListDiffResponse.ChecksumOrBuilder>( + getChecksum(), getParentForChildren(), isClean()); + checksum_ = null; + } + return checksumBuilder_; + } + + private com.google.protobuf.Timestamp recommendedNextDiff_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + recommendedNextDiffBuilder_; + /** + * + * + *
+     * The soonest the client should wait before issuing any diff
+     * request. Querying sooner is unlikely to produce a meaningful diff.
+     * Waiting longer is acceptable considering the use case.
+     * If this field is not set clients may update as soon as they want.
+     * 
+ * + * .google.protobuf.Timestamp recommended_next_diff = 2; + * + * @return Whether the recommendedNextDiff field is set. + */ + public boolean hasRecommendedNextDiff() { + return recommendedNextDiffBuilder_ != null || recommendedNextDiff_ != null; + } + /** + * + * + *
+     * The soonest the client should wait before issuing any diff
+     * request. Querying sooner is unlikely to produce a meaningful diff.
+     * Waiting longer is acceptable considering the use case.
+     * If this field is not set clients may update as soon as they want.
+     * 
+ * + * .google.protobuf.Timestamp recommended_next_diff = 2; + * + * @return The recommendedNextDiff. + */ + public com.google.protobuf.Timestamp getRecommendedNextDiff() { + if (recommendedNextDiffBuilder_ == null) { + return recommendedNextDiff_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : recommendedNextDiff_; + } else { + return recommendedNextDiffBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The soonest the client should wait before issuing any diff
+     * request. Querying sooner is unlikely to produce a meaningful diff.
+     * Waiting longer is acceptable considering the use case.
+     * If this field is not set clients may update as soon as they want.
+     * 
+ * + * .google.protobuf.Timestamp recommended_next_diff = 2; + */ + public Builder setRecommendedNextDiff(com.google.protobuf.Timestamp value) { + if (recommendedNextDiffBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + recommendedNextDiff_ = value; + onChanged(); + } else { + recommendedNextDiffBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The soonest the client should wait before issuing any diff
+     * request. Querying sooner is unlikely to produce a meaningful diff.
+     * Waiting longer is acceptable considering the use case.
+     * If this field is not set clients may update as soon as they want.
+     * 
+ * + * .google.protobuf.Timestamp recommended_next_diff = 2; + */ + public Builder setRecommendedNextDiff(com.google.protobuf.Timestamp.Builder builderForValue) { + if (recommendedNextDiffBuilder_ == null) { + recommendedNextDiff_ = builderForValue.build(); + onChanged(); + } else { + recommendedNextDiffBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The soonest the client should wait before issuing any diff
+     * request. Querying sooner is unlikely to produce a meaningful diff.
+     * Waiting longer is acceptable considering the use case.
+     * If this field is not set clients may update as soon as they want.
+     * 
+ * + * .google.protobuf.Timestamp recommended_next_diff = 2; + */ + public Builder mergeRecommendedNextDiff(com.google.protobuf.Timestamp value) { + if (recommendedNextDiffBuilder_ == null) { + if (recommendedNextDiff_ != null) { + recommendedNextDiff_ = + com.google.protobuf.Timestamp.newBuilder(recommendedNextDiff_) + .mergeFrom(value) + .buildPartial(); + } else { + recommendedNextDiff_ = value; + } + onChanged(); + } else { + recommendedNextDiffBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The soonest the client should wait before issuing any diff
+     * request. Querying sooner is unlikely to produce a meaningful diff.
+     * Waiting longer is acceptable considering the use case.
+     * If this field is not set clients may update as soon as they want.
+     * 
+ * + * .google.protobuf.Timestamp recommended_next_diff = 2; + */ + public Builder clearRecommendedNextDiff() { + if (recommendedNextDiffBuilder_ == null) { + recommendedNextDiff_ = null; + onChanged(); + } else { + recommendedNextDiff_ = null; + recommendedNextDiffBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The soonest the client should wait before issuing any diff
+     * request. Querying sooner is unlikely to produce a meaningful diff.
+     * Waiting longer is acceptable considering the use case.
+     * If this field is not set clients may update as soon as they want.
+     * 
+ * + * .google.protobuf.Timestamp recommended_next_diff = 2; + */ + public com.google.protobuf.Timestamp.Builder getRecommendedNextDiffBuilder() { + + onChanged(); + return getRecommendedNextDiffFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The soonest the client should wait before issuing any diff
+     * request. Querying sooner is unlikely to produce a meaningful diff.
+     * Waiting longer is acceptable considering the use case.
+     * If this field is not set clients may update as soon as they want.
+     * 
+ * + * .google.protobuf.Timestamp recommended_next_diff = 2; + */ + public com.google.protobuf.TimestampOrBuilder getRecommendedNextDiffOrBuilder() { + if (recommendedNextDiffBuilder_ != null) { + return recommendedNextDiffBuilder_.getMessageOrBuilder(); + } else { + return recommendedNextDiff_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : recommendedNextDiff_; + } + } + /** + * + * + *
+     * The soonest the client should wait before issuing any diff
+     * request. Querying sooner is unlikely to produce a meaningful diff.
+     * Waiting longer is acceptable considering the use case.
+     * If this field is not set clients may update as soon as they want.
+     * 
+ * + * .google.protobuf.Timestamp recommended_next_diff = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getRecommendedNextDiffFieldBuilder() { + if (recommendedNextDiffBuilder_ == null) { + recommendedNextDiffBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getRecommendedNextDiff(), getParentForChildren(), isClean()); + recommendedNextDiff_ = null; + } + return recommendedNextDiffBuilder_; + } + + @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.ComputeThreatListDiffResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.ComputeThreatListDiffResponse) + private static final com.google.webrisk.v1.ComputeThreatListDiffResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.webrisk.v1.ComputeThreatListDiffResponse(); + } + + public static com.google.webrisk.v1.ComputeThreatListDiffResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ComputeThreatListDiffResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ComputeThreatListDiffResponse(input, extensionRegistry); + } + }; + + 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.ComputeThreatListDiffResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ComputeThreatListDiffResponseOrBuilder.java b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ComputeThreatListDiffResponseOrBuilder.java new file mode 100644 index 00000000..fe182eed --- /dev/null +++ b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ComputeThreatListDiffResponseOrBuilder.java @@ -0,0 +1,230 @@ +/* + * 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 ComputeThreatListDiffResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.webrisk.v1.ComputeThreatListDiffResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The type of response. This may indicate that an action must be taken by the
+   * client when the response is received.
+   * 
+ * + * .google.cloud.webrisk.v1.ComputeThreatListDiffResponse.ResponseType response_type = 4; + * + * + * @return The enum numeric value on the wire for responseType. + */ + int getResponseTypeValue(); + /** + * + * + *
+   * The type of response. This may indicate that an action must be taken by the
+   * client when the response is received.
+   * 
+ * + * .google.cloud.webrisk.v1.ComputeThreatListDiffResponse.ResponseType response_type = 4; + * + * + * @return The responseType. + */ + com.google.webrisk.v1.ComputeThreatListDiffResponse.ResponseType getResponseType(); + + /** + * + * + *
+   * A set of entries to add to a local threat type's list.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatEntryAdditions additions = 5; + * + * @return Whether the additions field is set. + */ + boolean hasAdditions(); + /** + * + * + *
+   * A set of entries to add to a local threat type's list.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatEntryAdditions additions = 5; + * + * @return The additions. + */ + com.google.webrisk.v1.ThreatEntryAdditions getAdditions(); + /** + * + * + *
+   * A set of entries to add to a local threat type's list.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatEntryAdditions additions = 5; + */ + com.google.webrisk.v1.ThreatEntryAdditionsOrBuilder getAdditionsOrBuilder(); + + /** + * + * + *
+   * A set of entries to remove from a local threat type's list.
+   * This field may be empty.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatEntryRemovals removals = 6; + * + * @return Whether the removals field is set. + */ + boolean hasRemovals(); + /** + * + * + *
+   * A set of entries to remove from a local threat type's list.
+   * This field may be empty.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatEntryRemovals removals = 6; + * + * @return The removals. + */ + com.google.webrisk.v1.ThreatEntryRemovals getRemovals(); + /** + * + * + *
+   * A set of entries to remove from a local threat type's list.
+   * This field may be empty.
+   * 
+ * + * .google.cloud.webrisk.v1.ThreatEntryRemovals removals = 6; + */ + com.google.webrisk.v1.ThreatEntryRemovalsOrBuilder getRemovalsOrBuilder(); + + /** + * + * + *
+   * The new opaque client version token. This should be retained by the client
+   * and passed into the next call of ComputeThreatListDiff as 'version_token'.
+   * A separate version token should be stored and used for each threatList.
+   * 
+ * + * bytes new_version_token = 7; + * + * @return The newVersionToken. + */ + com.google.protobuf.ByteString getNewVersionToken(); + + /** + * + * + *
+   * The expected SHA256 hash of the client state; that is, of the sorted list
+   * of all hashes present in the database after applying the provided diff.
+   * If the client state doesn't match the expected state, the client must
+   * discard this diff and retry later.
+   * 
+ * + * .google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum checksum = 8; + * + * @return Whether the checksum field is set. + */ + boolean hasChecksum(); + /** + * + * + *
+   * The expected SHA256 hash of the client state; that is, of the sorted list
+   * of all hashes present in the database after applying the provided diff.
+   * If the client state doesn't match the expected state, the client must
+   * discard this diff and retry later.
+   * 
+ * + * .google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum checksum = 8; + * + * @return The checksum. + */ + com.google.webrisk.v1.ComputeThreatListDiffResponse.Checksum getChecksum(); + /** + * + * + *
+   * The expected SHA256 hash of the client state; that is, of the sorted list
+   * of all hashes present in the database after applying the provided diff.
+   * If the client state doesn't match the expected state, the client must
+   * discard this diff and retry later.
+   * 
+ * + * .google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum checksum = 8; + */ + com.google.webrisk.v1.ComputeThreatListDiffResponse.ChecksumOrBuilder getChecksumOrBuilder(); + + /** + * + * + *
+   * The soonest the client should wait before issuing any diff
+   * request. Querying sooner is unlikely to produce a meaningful diff.
+   * Waiting longer is acceptable considering the use case.
+   * If this field is not set clients may update as soon as they want.
+   * 
+ * + * .google.protobuf.Timestamp recommended_next_diff = 2; + * + * @return Whether the recommendedNextDiff field is set. + */ + boolean hasRecommendedNextDiff(); + /** + * + * + *
+   * The soonest the client should wait before issuing any diff
+   * request. Querying sooner is unlikely to produce a meaningful diff.
+   * Waiting longer is acceptable considering the use case.
+   * If this field is not set clients may update as soon as they want.
+   * 
+ * + * .google.protobuf.Timestamp recommended_next_diff = 2; + * + * @return The recommendedNextDiff. + */ + com.google.protobuf.Timestamp getRecommendedNextDiff(); + /** + * + * + *
+   * The soonest the client should wait before issuing any diff
+   * request. Querying sooner is unlikely to produce a meaningful diff.
+   * Waiting longer is acceptable considering the use case.
+   * If this field is not set clients may update as soon as they want.
+   * 
+ * + * .google.protobuf.Timestamp recommended_next_diff = 2; + */ + com.google.protobuf.TimestampOrBuilder getRecommendedNextDiffOrBuilder(); +} diff --git a/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/CreateSubmissionRequest.java b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/CreateSubmissionRequest.java new file mode 100644 index 00000000..104068d8 --- /dev/null +++ b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/CreateSubmissionRequest.java @@ -0,0 +1,950 @@ +/* + * 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 phishy URI to WebRisk.
+ * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.CreateSubmissionRequest} + */ +public final class CreateSubmissionRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.webrisk.v1.CreateSubmissionRequest) + CreateSubmissionRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use CreateSubmissionRequest.newBuilder() to construct. + private CreateSubmissionRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CreateSubmissionRequest() { + parent_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new CreateSubmissionRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private CreateSubmissionRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 18: + { + com.google.webrisk.v1.Submission.Builder subBuilder = null; + if (submission_ != null) { + subBuilder = submission_.toBuilder(); + } + submission_ = + input.readMessage(com.google.webrisk.v1.Submission.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(submission_); + submission_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_CreateSubmissionRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_CreateSubmissionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.CreateSubmissionRequest.class, + com.google.webrisk.v1.CreateSubmissionRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + 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. + */ + 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. + */ + 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 content of the phishing report.
+   * 
+ * + * + * .google.cloud.webrisk.v1.Submission submission = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the submission field is set. + */ + public boolean hasSubmission() { + return submission_ != null; + } + /** + * + * + *
+   * Required. The submission that contains the content of the phishing report.
+   * 
+ * + * + * .google.cloud.webrisk.v1.Submission submission = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The submission. + */ + public com.google.webrisk.v1.Submission getSubmission() { + return submission_ == null + ? com.google.webrisk.v1.Submission.getDefaultInstance() + : submission_; + } + /** + * + * + *
+   * Required. The submission that contains the content of the phishing report.
+   * 
+ * + * + * .google.cloud.webrisk.v1.Submission submission = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.webrisk.v1.SubmissionOrBuilder getSubmissionOrBuilder() { + return getSubmission(); + } + + 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 (!getParentBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (submission_ != null) { + output.writeMessage(2, getSubmission()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getParentBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (submission_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getSubmission()); + } + size += unknownFields.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.CreateSubmissionRequest)) { + return super.equals(obj); + } + com.google.webrisk.v1.CreateSubmissionRequest other = + (com.google.webrisk.v1.CreateSubmissionRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (hasSubmission() != other.hasSubmission()) return false; + if (hasSubmission()) { + if (!getSubmission().equals(other.getSubmission())) return false; + } + if (!unknownFields.equals(other.unknownFields)) 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(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.webrisk.v1.CreateSubmissionRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.CreateSubmissionRequest 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.CreateSubmissionRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.CreateSubmissionRequest 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.CreateSubmissionRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.CreateSubmissionRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.CreateSubmissionRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.CreateSubmissionRequest 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.CreateSubmissionRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.CreateSubmissionRequest 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.CreateSubmissionRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.CreateSubmissionRequest 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.CreateSubmissionRequest 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 phishy URI to WebRisk.
+   * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.CreateSubmissionRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.webrisk.v1.CreateSubmissionRequest) + com.google.webrisk.v1.CreateSubmissionRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_CreateSubmissionRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_CreateSubmissionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.CreateSubmissionRequest.class, + com.google.webrisk.v1.CreateSubmissionRequest.Builder.class); + } + + // Construct using com.google.webrisk.v1.CreateSubmissionRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + if (submissionBuilder_ == null) { + submission_ = null; + } else { + submission_ = null; + submissionBuilder_ = 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_CreateSubmissionRequest_descriptor; + } + + @java.lang.Override + public com.google.webrisk.v1.CreateSubmissionRequest getDefaultInstanceForType() { + return com.google.webrisk.v1.CreateSubmissionRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.webrisk.v1.CreateSubmissionRequest build() { + com.google.webrisk.v1.CreateSubmissionRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.webrisk.v1.CreateSubmissionRequest buildPartial() { + com.google.webrisk.v1.CreateSubmissionRequest result = + new com.google.webrisk.v1.CreateSubmissionRequest(this); + result.parent_ = parent_; + if (submissionBuilder_ == null) { + result.submission_ = submission_; + } else { + result.submission_ = submissionBuilder_.build(); + } + onBuilt(); + return result; + } + + @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.CreateSubmissionRequest) { + return mergeFrom((com.google.webrisk.v1.CreateSubmissionRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.webrisk.v1.CreateSubmissionRequest other) { + if (other == com.google.webrisk.v1.CreateSubmissionRequest.getDefaultInstance()) return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.hasSubmission()) { + mergeSubmission(other.getSubmission()); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.webrisk.v1.CreateSubmissionRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.webrisk.v1.CreateSubmissionRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + 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; + 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(); + 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; + 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 content of the phishing report.
+     * 
+ * + * + * .google.cloud.webrisk.v1.Submission submission = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the submission field is set. + */ + public boolean hasSubmission() { + return submissionBuilder_ != null || submission_ != null; + } + /** + * + * + *
+     * Required. The submission that contains the content of the phishing report.
+     * 
+ * + * + * .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 content of the phishing report.
+     * 
+ * + * + * .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; + onChanged(); + } else { + submissionBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The submission that contains the content of the phishing report.
+     * 
+ * + * + * .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(); + onChanged(); + } else { + submissionBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The submission that contains the content of the phishing report.
+     * 
+ * + * + * .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 (submission_ != null) { + submission_ = + com.google.webrisk.v1.Submission.newBuilder(submission_) + .mergeFrom(value) + .buildPartial(); + } else { + submission_ = value; + } + onChanged(); + } else { + submissionBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The submission that contains the content of the phishing report.
+     * 
+ * + * + * .google.cloud.webrisk.v1.Submission submission = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearSubmission() { + if (submissionBuilder_ == null) { + submission_ = null; + onChanged(); + } else { + submission_ = null; + submissionBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The submission that contains the content of the phishing report.
+     * 
+ * + * + * .google.cloud.webrisk.v1.Submission submission = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.webrisk.v1.Submission.Builder getSubmissionBuilder() { + + onChanged(); + return getSubmissionFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The submission that contains the content of the phishing report.
+     * 
+ * + * + * .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 content of the phishing report.
+     * 
+ * + * + * .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_; + } + + @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.CreateSubmissionRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.CreateSubmissionRequest) + private static final com.google.webrisk.v1.CreateSubmissionRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.webrisk.v1.CreateSubmissionRequest(); + } + + public static com.google.webrisk.v1.CreateSubmissionRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CreateSubmissionRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CreateSubmissionRequest(input, extensionRegistry); + } + }; + + 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.CreateSubmissionRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/CreateSubmissionRequestOrBuilder.java b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/CreateSubmissionRequestOrBuilder.java new file mode 100644 index 00000000..217fe1ef --- /dev/null +++ b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/CreateSubmissionRequestOrBuilder.java @@ -0,0 +1,97 @@ +/* + * 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 CreateSubmissionRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.webrisk.v1.CreateSubmissionRequest) + 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 content of the phishing report.
+   * 
+ * + * + * .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 content of the phishing report.
+   * 
+ * + * + * .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 content of the phishing report.
+   * 
+ * + * + * .google.cloud.webrisk.v1.Submission submission = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.webrisk.v1.SubmissionOrBuilder getSubmissionOrBuilder(); +} diff --git a/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ProjectName.java b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ProjectName.java new file mode 100644 index 00000000..05578939 --- /dev/null +++ b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ProjectName.java @@ -0,0 +1,162 @@ +/* + * 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. + */ + +package com.google.webrisk.v1; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** AUTO-GENERATED DOCUMENTATION AND CLASS */ +@javax.annotation.Generated("by GAPIC protoc plugin") +public class ProjectName implements ResourceName { + + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}"); + + private volatile Map fieldValuesMap; + + private final String project; + + public String getProject() { + return project; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + } + + public static ProjectName of(String project) { + return newBuilder().setProject(project).build(); + } + + public static String format(String project) { + return newBuilder().setProject(project).build().toString(); + } + + public static ProjectName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, "ProjectName.parse: formattedString not in valid format"); + return of(matchMap.get("project")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList(values.size()); + for (ProjectName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate("project", project); + } + + /** Builder for ProjectName. */ + public static class Builder { + + private String project; + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + private Builder() {} + + private Builder(ProjectName projectName) { + project = projectName.project; + } + + public ProjectName build() { + return new ProjectName(this); + } + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectName) { + ProjectName that = (ProjectName) o; + return (this.project.equals(that.project)); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= project.hashCode(); + return h; + } +} diff --git a/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/RawHashes.java b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/RawHashes.java new file mode 100644 index 00000000..6801bfe5 --- /dev/null +++ b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/RawHashes.java @@ -0,0 +1,658 @@ +/* + * 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; + +/** + * + * + *
+ * The uncompressed threat entries in hash format.
+ * Hashes can be anywhere from 4 to 32 bytes in size. A large majority are 4
+ * bytes, but some hashes are lengthened if they collide with the hash of a
+ * popular URI.
+ * Used for sending ThreatEntryAdditons to clients that do not support
+ * compression, or when sending non-4-byte hashes to clients that do support
+ * compression.
+ * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.RawHashes} + */ +public final class RawHashes extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.webrisk.v1.RawHashes) + RawHashesOrBuilder { + private static final long serialVersionUID = 0L; + // Use RawHashes.newBuilder() to construct. + private RawHashes(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private RawHashes() { + rawHashes_ = com.google.protobuf.ByteString.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new RawHashes(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private RawHashes( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + prefixSize_ = input.readInt32(); + break; + } + case 18: + { + rawHashes_ = input.readBytes(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_RawHashes_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_RawHashes_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.RawHashes.class, com.google.webrisk.v1.RawHashes.Builder.class); + } + + public static final int PREFIX_SIZE_FIELD_NUMBER = 1; + private int prefixSize_; + /** + * + * + *
+   * The number of bytes for each prefix encoded below.  This field can be
+   * anywhere from 4 (shortest prefix) to 32 (full SHA256 hash).
+   * In practice this is almost always 4, except in exceptional circumstances.
+   * 
+ * + * int32 prefix_size = 1; + * + * @return The prefixSize. + */ + public int getPrefixSize() { + return prefixSize_; + } + + public static final int RAW_HASHES_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString rawHashes_; + /** + * + * + *
+   * The hashes, in binary format, concatenated into one long string. Hashes are
+   * sorted in lexicographic order. For JSON API users, hashes are
+   * base64-encoded.
+   * 
+ * + * bytes raw_hashes = 2; + * + * @return The rawHashes. + */ + public com.google.protobuf.ByteString getRawHashes() { + return rawHashes_; + } + + 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 (prefixSize_ != 0) { + output.writeInt32(1, prefixSize_); + } + if (!rawHashes_.isEmpty()) { + output.writeBytes(2, rawHashes_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (prefixSize_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(1, prefixSize_); + } + if (!rawHashes_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream.computeBytesSize(2, rawHashes_); + } + size += unknownFields.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.RawHashes)) { + return super.equals(obj); + } + com.google.webrisk.v1.RawHashes other = (com.google.webrisk.v1.RawHashes) obj; + + if (getPrefixSize() != other.getPrefixSize()) return false; + if (!getRawHashes().equals(other.getRawHashes())) return false; + if (!unknownFields.equals(other.unknownFields)) 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) + PREFIX_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPrefixSize(); + hash = (37 * hash) + RAW_HASHES_FIELD_NUMBER; + hash = (53 * hash) + getRawHashes().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.webrisk.v1.RawHashes parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.RawHashes 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.RawHashes parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.RawHashes 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.RawHashes parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.RawHashes parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.RawHashes parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.RawHashes 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.RawHashes parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.RawHashes 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.RawHashes parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.RawHashes 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.RawHashes 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; + } + /** + * + * + *
+   * The uncompressed threat entries in hash format.
+   * Hashes can be anywhere from 4 to 32 bytes in size. A large majority are 4
+   * bytes, but some hashes are lengthened if they collide with the hash of a
+   * popular URI.
+   * Used for sending ThreatEntryAdditons to clients that do not support
+   * compression, or when sending non-4-byte hashes to clients that do support
+   * compression.
+   * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.RawHashes} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.webrisk.v1.RawHashes) + com.google.webrisk.v1.RawHashesOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_RawHashes_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_RawHashes_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.RawHashes.class, com.google.webrisk.v1.RawHashes.Builder.class); + } + + // Construct using com.google.webrisk.v1.RawHashes.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + prefixSize_ = 0; + + rawHashes_ = com.google.protobuf.ByteString.EMPTY; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_RawHashes_descriptor; + } + + @java.lang.Override + public com.google.webrisk.v1.RawHashes getDefaultInstanceForType() { + return com.google.webrisk.v1.RawHashes.getDefaultInstance(); + } + + @java.lang.Override + public com.google.webrisk.v1.RawHashes build() { + com.google.webrisk.v1.RawHashes result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.webrisk.v1.RawHashes buildPartial() { + com.google.webrisk.v1.RawHashes result = new com.google.webrisk.v1.RawHashes(this); + result.prefixSize_ = prefixSize_; + result.rawHashes_ = rawHashes_; + onBuilt(); + return result; + } + + @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.RawHashes) { + return mergeFrom((com.google.webrisk.v1.RawHashes) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.webrisk.v1.RawHashes other) { + if (other == com.google.webrisk.v1.RawHashes.getDefaultInstance()) return this; + if (other.getPrefixSize() != 0) { + setPrefixSize(other.getPrefixSize()); + } + if (other.getRawHashes() != com.google.protobuf.ByteString.EMPTY) { + setRawHashes(other.getRawHashes()); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.webrisk.v1.RawHashes parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.webrisk.v1.RawHashes) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int prefixSize_; + /** + * + * + *
+     * The number of bytes for each prefix encoded below.  This field can be
+     * anywhere from 4 (shortest prefix) to 32 (full SHA256 hash).
+     * In practice this is almost always 4, except in exceptional circumstances.
+     * 
+ * + * int32 prefix_size = 1; + * + * @return The prefixSize. + */ + public int getPrefixSize() { + return prefixSize_; + } + /** + * + * + *
+     * The number of bytes for each prefix encoded below.  This field can be
+     * anywhere from 4 (shortest prefix) to 32 (full SHA256 hash).
+     * In practice this is almost always 4, except in exceptional circumstances.
+     * 
+ * + * int32 prefix_size = 1; + * + * @param value The prefixSize to set. + * @return This builder for chaining. + */ + public Builder setPrefixSize(int value) { + + prefixSize_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The number of bytes for each prefix encoded below.  This field can be
+     * anywhere from 4 (shortest prefix) to 32 (full SHA256 hash).
+     * In practice this is almost always 4, except in exceptional circumstances.
+     * 
+ * + * int32 prefix_size = 1; + * + * @return This builder for chaining. + */ + public Builder clearPrefixSize() { + + prefixSize_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.ByteString rawHashes_ = com.google.protobuf.ByteString.EMPTY; + /** + * + * + *
+     * The hashes, in binary format, concatenated into one long string. Hashes are
+     * sorted in lexicographic order. For JSON API users, hashes are
+     * base64-encoded.
+     * 
+ * + * bytes raw_hashes = 2; + * + * @return The rawHashes. + */ + public com.google.protobuf.ByteString getRawHashes() { + return rawHashes_; + } + /** + * + * + *
+     * The hashes, in binary format, concatenated into one long string. Hashes are
+     * sorted in lexicographic order. For JSON API users, hashes are
+     * base64-encoded.
+     * 
+ * + * bytes raw_hashes = 2; + * + * @param value The rawHashes to set. + * @return This builder for chaining. + */ + public Builder setRawHashes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + + rawHashes_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The hashes, in binary format, concatenated into one long string. Hashes are
+     * sorted in lexicographic order. For JSON API users, hashes are
+     * base64-encoded.
+     * 
+ * + * bytes raw_hashes = 2; + * + * @return This builder for chaining. + */ + public Builder clearRawHashes() { + + rawHashes_ = getDefaultInstance().getRawHashes(); + 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.RawHashes) + } + + // @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.RawHashes) + private static final com.google.webrisk.v1.RawHashes DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.webrisk.v1.RawHashes(); + } + + public static com.google.webrisk.v1.RawHashes getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public RawHashes parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new RawHashes(input, extensionRegistry); + } + }; + + 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.RawHashes getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/RawHashesOrBuilder.java b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/RawHashesOrBuilder.java new file mode 100644 index 00000000..52099e51 --- /dev/null +++ b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/RawHashesOrBuilder.java @@ -0,0 +1,55 @@ +/* + * 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 RawHashesOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.webrisk.v1.RawHashes) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The number of bytes for each prefix encoded below.  This field can be
+   * anywhere from 4 (shortest prefix) to 32 (full SHA256 hash).
+   * In practice this is almost always 4, except in exceptional circumstances.
+   * 
+ * + * int32 prefix_size = 1; + * + * @return The prefixSize. + */ + int getPrefixSize(); + + /** + * + * + *
+   * The hashes, in binary format, concatenated into one long string. Hashes are
+   * sorted in lexicographic order. For JSON API users, hashes are
+   * base64-encoded.
+   * 
+ * + * bytes raw_hashes = 2; + * + * @return The rawHashes. + */ + com.google.protobuf.ByteString getRawHashes(); +} diff --git a/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/RawIndices.java b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/RawIndices.java new file mode 100644 index 00000000..f240788b --- /dev/null +++ b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/RawIndices.java @@ -0,0 +1,698 @@ +/* + * 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; + +/** + * + * + *
+ * A set of raw indices to remove from a local list.
+ * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.RawIndices} + */ +public final class RawIndices extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.webrisk.v1.RawIndices) + RawIndicesOrBuilder { + private static final long serialVersionUID = 0L; + // Use RawIndices.newBuilder() to construct. + private RawIndices(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private RawIndices() { + indices_ = emptyIntList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new RawIndices(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private RawIndices( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + indices_ = newIntList(); + mutable_bitField0_ |= 0x00000001; + } + indices_.addInt(input.readInt32()); + break; + } + case 10: + { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + if (!((mutable_bitField0_ & 0x00000001) != 0) && input.getBytesUntilLimit() > 0) { + indices_ = newIntList(); + mutable_bitField0_ |= 0x00000001; + } + while (input.getBytesUntilLimit() > 0) { + indices_.addInt(input.readInt32()); + } + input.popLimit(limit); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + indices_.makeImmutable(); // C + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_RawIndices_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_RawIndices_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.RawIndices.class, com.google.webrisk.v1.RawIndices.Builder.class); + } + + public static final int INDICES_FIELD_NUMBER = 1; + private com.google.protobuf.Internal.IntList indices_; + /** + * + * + *
+   * The indices to remove from a lexicographically-sorted local list.
+   * 
+ * + * repeated int32 indices = 1; + * + * @return A list containing the indices. + */ + public java.util.List getIndicesList() { + return indices_; + } + /** + * + * + *
+   * The indices to remove from a lexicographically-sorted local list.
+   * 
+ * + * repeated int32 indices = 1; + * + * @return The count of indices. + */ + public int getIndicesCount() { + return indices_.size(); + } + /** + * + * + *
+   * The indices to remove from a lexicographically-sorted local list.
+   * 
+ * + * repeated int32 indices = 1; + * + * @param index The index of the element to return. + * @return The indices at the given index. + */ + public int getIndices(int index) { + return indices_.getInt(index); + } + + private int indicesMemoizedSerializedSize = -1; + + 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 (getIndicesList().size() > 0) { + output.writeUInt32NoTag(10); + output.writeUInt32NoTag(indicesMemoizedSerializedSize); + } + for (int i = 0; i < indices_.size(); i++) { + output.writeInt32NoTag(indices_.getInt(i)); + } + unknownFields.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 < indices_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(indices_.getInt(i)); + } + size += dataSize; + if (!getIndicesList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(dataSize); + } + indicesMemoizedSerializedSize = dataSize; + } + size += unknownFields.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.RawIndices)) { + return super.equals(obj); + } + com.google.webrisk.v1.RawIndices other = (com.google.webrisk.v1.RawIndices) obj; + + if (!getIndicesList().equals(other.getIndicesList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getIndicesCount() > 0) { + hash = (37 * hash) + INDICES_FIELD_NUMBER; + hash = (53 * hash) + getIndicesList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.webrisk.v1.RawIndices parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.RawIndices 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.RawIndices parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.RawIndices 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.RawIndices parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.RawIndices parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.RawIndices parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.RawIndices 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.RawIndices parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.RawIndices 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.RawIndices parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.RawIndices 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.RawIndices 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; + } + /** + * + * + *
+   * A set of raw indices to remove from a local list.
+   * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.RawIndices} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.webrisk.v1.RawIndices) + com.google.webrisk.v1.RawIndicesOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_RawIndices_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_RawIndices_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.RawIndices.class, + com.google.webrisk.v1.RawIndices.Builder.class); + } + + // Construct using com.google.webrisk.v1.RawIndices.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + indices_ = emptyIntList(); + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_RawIndices_descriptor; + } + + @java.lang.Override + public com.google.webrisk.v1.RawIndices getDefaultInstanceForType() { + return com.google.webrisk.v1.RawIndices.getDefaultInstance(); + } + + @java.lang.Override + public com.google.webrisk.v1.RawIndices build() { + com.google.webrisk.v1.RawIndices result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.webrisk.v1.RawIndices buildPartial() { + com.google.webrisk.v1.RawIndices result = new com.google.webrisk.v1.RawIndices(this); + int from_bitField0_ = bitField0_; + if (((bitField0_ & 0x00000001) != 0)) { + indices_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.indices_ = indices_; + onBuilt(); + return result; + } + + @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.RawIndices) { + return mergeFrom((com.google.webrisk.v1.RawIndices) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.webrisk.v1.RawIndices other) { + if (other == com.google.webrisk.v1.RawIndices.getDefaultInstance()) return this; + if (!other.indices_.isEmpty()) { + if (indices_.isEmpty()) { + indices_ = other.indices_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureIndicesIsMutable(); + indices_.addAll(other.indices_); + } + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.webrisk.v1.RawIndices parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.webrisk.v1.RawIndices) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private com.google.protobuf.Internal.IntList indices_ = emptyIntList(); + + private void ensureIndicesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + indices_ = mutableCopy(indices_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+     * The indices to remove from a lexicographically-sorted local list.
+     * 
+ * + * repeated int32 indices = 1; + * + * @return A list containing the indices. + */ + public java.util.List getIndicesList() { + return ((bitField0_ & 0x00000001) != 0) + ? java.util.Collections.unmodifiableList(indices_) + : indices_; + } + /** + * + * + *
+     * The indices to remove from a lexicographically-sorted local list.
+     * 
+ * + * repeated int32 indices = 1; + * + * @return The count of indices. + */ + public int getIndicesCount() { + return indices_.size(); + } + /** + * + * + *
+     * The indices to remove from a lexicographically-sorted local list.
+     * 
+ * + * repeated int32 indices = 1; + * + * @param index The index of the element to return. + * @return The indices at the given index. + */ + public int getIndices(int index) { + return indices_.getInt(index); + } + /** + * + * + *
+     * The indices to remove from a lexicographically-sorted local list.
+     * 
+ * + * repeated int32 indices = 1; + * + * @param index The index to set the value at. + * @param value The indices to set. + * @return This builder for chaining. + */ + public Builder setIndices(int index, int value) { + ensureIndicesIsMutable(); + indices_.setInt(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * The indices to remove from a lexicographically-sorted local list.
+     * 
+ * + * repeated int32 indices = 1; + * + * @param value The indices to add. + * @return This builder for chaining. + */ + public Builder addIndices(int value) { + ensureIndicesIsMutable(); + indices_.addInt(value); + onChanged(); + return this; + } + /** + * + * + *
+     * The indices to remove from a lexicographically-sorted local list.
+     * 
+ * + * repeated int32 indices = 1; + * + * @param values The indices to add. + * @return This builder for chaining. + */ + public Builder addAllIndices(java.lang.Iterable values) { + ensureIndicesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, indices_); + onChanged(); + return this; + } + /** + * + * + *
+     * The indices to remove from a lexicographically-sorted local list.
+     * 
+ * + * repeated int32 indices = 1; + * + * @return This builder for chaining. + */ + public Builder clearIndices() { + indices_ = emptyIntList(); + bitField0_ = (bitField0_ & ~0x00000001); + 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.RawIndices) + } + + // @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.RawIndices) + private static final com.google.webrisk.v1.RawIndices DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.webrisk.v1.RawIndices(); + } + + public static com.google.webrisk.v1.RawIndices getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public RawIndices parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new RawIndices(input, extensionRegistry); + } + }; + + 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.RawIndices getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/RawIndicesOrBuilder.java b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/RawIndicesOrBuilder.java new file mode 100644 index 00000000..4097f703 --- /dev/null +++ b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/RawIndicesOrBuilder.java @@ -0,0 +1,63 @@ +/* + * 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 RawIndicesOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.webrisk.v1.RawIndices) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The indices to remove from a lexicographically-sorted local list.
+   * 
+ * + * repeated int32 indices = 1; + * + * @return A list containing the indices. + */ + java.util.List getIndicesList(); + /** + * + * + *
+   * The indices to remove from a lexicographically-sorted local list.
+   * 
+ * + * repeated int32 indices = 1; + * + * @return The count of indices. + */ + int getIndicesCount(); + /** + * + * + *
+   * The indices to remove from a lexicographically-sorted local list.
+   * 
+ * + * repeated int32 indices = 1; + * + * @param index The index of the element to return. + * @return The indices at the given index. + */ + int getIndices(int index); +} diff --git a/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/RiceDeltaEncoding.java b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/RiceDeltaEncoding.java new file mode 100644 index 00000000..80495b9c --- /dev/null +++ b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/RiceDeltaEncoding.java @@ -0,0 +1,832 @@ +/* + * 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; + +/** + * + * + *
+ * The Rice-Golomb encoded data. Used for sending compressed 4-byte hashes or
+ * compressed removal indices.
+ * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.RiceDeltaEncoding} + */ +public final class RiceDeltaEncoding extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.webrisk.v1.RiceDeltaEncoding) + RiceDeltaEncodingOrBuilder { + private static final long serialVersionUID = 0L; + // Use RiceDeltaEncoding.newBuilder() to construct. + private RiceDeltaEncoding(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private RiceDeltaEncoding() { + encodedData_ = com.google.protobuf.ByteString.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new RiceDeltaEncoding(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private RiceDeltaEncoding( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + firstValue_ = input.readInt64(); + break; + } + case 16: + { + riceParameter_ = input.readInt32(); + break; + } + case 24: + { + entryCount_ = input.readInt32(); + break; + } + case 34: + { + encodedData_ = input.readBytes(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_RiceDeltaEncoding_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_RiceDeltaEncoding_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.RiceDeltaEncoding.class, + com.google.webrisk.v1.RiceDeltaEncoding.Builder.class); + } + + public static final int FIRST_VALUE_FIELD_NUMBER = 1; + private long firstValue_; + /** + * + * + *
+   * The offset of the first entry in the encoded data, or, if only a single
+   * integer was encoded, that single integer's value. If the field is empty or
+   * missing, assume zero.
+   * 
+ * + * int64 first_value = 1; + * + * @return The firstValue. + */ + public long getFirstValue() { + return firstValue_; + } + + public static final int RICE_PARAMETER_FIELD_NUMBER = 2; + private int riceParameter_; + /** + * + * + *
+   * The Golomb-Rice parameter, which is a number between 2 and 28. This field
+   * is missing (that is, zero) if `num_entries` is zero.
+   * 
+ * + * int32 rice_parameter = 2; + * + * @return The riceParameter. + */ + public int getRiceParameter() { + return riceParameter_; + } + + public static final int ENTRY_COUNT_FIELD_NUMBER = 3; + private int entryCount_; + /** + * + * + *
+   * The number of entries that are delta encoded in the encoded data. If only a
+   * single integer was encoded, this will be zero and the single value will be
+   * stored in `first_value`.
+   * 
+ * + * int32 entry_count = 3; + * + * @return The entryCount. + */ + public int getEntryCount() { + return entryCount_; + } + + public static final int ENCODED_DATA_FIELD_NUMBER = 4; + private com.google.protobuf.ByteString encodedData_; + /** + * + * + *
+   * The encoded deltas that are encoded using the Golomb-Rice coder.
+   * 
+ * + * bytes encoded_data = 4; + * + * @return The encodedData. + */ + public com.google.protobuf.ByteString getEncodedData() { + return encodedData_; + } + + 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 (firstValue_ != 0L) { + output.writeInt64(1, firstValue_); + } + if (riceParameter_ != 0) { + output.writeInt32(2, riceParameter_); + } + if (entryCount_ != 0) { + output.writeInt32(3, entryCount_); + } + if (!encodedData_.isEmpty()) { + output.writeBytes(4, encodedData_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (firstValue_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(1, firstValue_); + } + if (riceParameter_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, riceParameter_); + } + if (entryCount_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(3, entryCount_); + } + if (!encodedData_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream.computeBytesSize(4, encodedData_); + } + size += unknownFields.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.RiceDeltaEncoding)) { + return super.equals(obj); + } + com.google.webrisk.v1.RiceDeltaEncoding other = (com.google.webrisk.v1.RiceDeltaEncoding) obj; + + if (getFirstValue() != other.getFirstValue()) return false; + if (getRiceParameter() != other.getRiceParameter()) return false; + if (getEntryCount() != other.getEntryCount()) return false; + if (!getEncodedData().equals(other.getEncodedData())) return false; + if (!unknownFields.equals(other.unknownFields)) 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) + FIRST_VALUE_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getFirstValue()); + hash = (37 * hash) + RICE_PARAMETER_FIELD_NUMBER; + hash = (53 * hash) + getRiceParameter(); + hash = (37 * hash) + ENTRY_COUNT_FIELD_NUMBER; + hash = (53 * hash) + getEntryCount(); + hash = (37 * hash) + ENCODED_DATA_FIELD_NUMBER; + hash = (53 * hash) + getEncodedData().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.webrisk.v1.RiceDeltaEncoding parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.RiceDeltaEncoding 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.RiceDeltaEncoding parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.RiceDeltaEncoding 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.RiceDeltaEncoding parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.RiceDeltaEncoding parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.RiceDeltaEncoding parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.RiceDeltaEncoding 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.RiceDeltaEncoding parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.RiceDeltaEncoding 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.RiceDeltaEncoding parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.RiceDeltaEncoding 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.RiceDeltaEncoding 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; + } + /** + * + * + *
+   * The Rice-Golomb encoded data. Used for sending compressed 4-byte hashes or
+   * compressed removal indices.
+   * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.RiceDeltaEncoding} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.webrisk.v1.RiceDeltaEncoding) + com.google.webrisk.v1.RiceDeltaEncodingOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_RiceDeltaEncoding_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_RiceDeltaEncoding_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.RiceDeltaEncoding.class, + com.google.webrisk.v1.RiceDeltaEncoding.Builder.class); + } + + // Construct using com.google.webrisk.v1.RiceDeltaEncoding.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + firstValue_ = 0L; + + riceParameter_ = 0; + + entryCount_ = 0; + + encodedData_ = com.google.protobuf.ByteString.EMPTY; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_RiceDeltaEncoding_descriptor; + } + + @java.lang.Override + public com.google.webrisk.v1.RiceDeltaEncoding getDefaultInstanceForType() { + return com.google.webrisk.v1.RiceDeltaEncoding.getDefaultInstance(); + } + + @java.lang.Override + public com.google.webrisk.v1.RiceDeltaEncoding build() { + com.google.webrisk.v1.RiceDeltaEncoding result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.webrisk.v1.RiceDeltaEncoding buildPartial() { + com.google.webrisk.v1.RiceDeltaEncoding result = + new com.google.webrisk.v1.RiceDeltaEncoding(this); + result.firstValue_ = firstValue_; + result.riceParameter_ = riceParameter_; + result.entryCount_ = entryCount_; + result.encodedData_ = encodedData_; + onBuilt(); + return result; + } + + @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.RiceDeltaEncoding) { + return mergeFrom((com.google.webrisk.v1.RiceDeltaEncoding) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.webrisk.v1.RiceDeltaEncoding other) { + if (other == com.google.webrisk.v1.RiceDeltaEncoding.getDefaultInstance()) return this; + if (other.getFirstValue() != 0L) { + setFirstValue(other.getFirstValue()); + } + if (other.getRiceParameter() != 0) { + setRiceParameter(other.getRiceParameter()); + } + if (other.getEntryCount() != 0) { + setEntryCount(other.getEntryCount()); + } + if (other.getEncodedData() != com.google.protobuf.ByteString.EMPTY) { + setEncodedData(other.getEncodedData()); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.webrisk.v1.RiceDeltaEncoding parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.webrisk.v1.RiceDeltaEncoding) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private long firstValue_; + /** + * + * + *
+     * The offset of the first entry in the encoded data, or, if only a single
+     * integer was encoded, that single integer's value. If the field is empty or
+     * missing, assume zero.
+     * 
+ * + * int64 first_value = 1; + * + * @return The firstValue. + */ + public long getFirstValue() { + return firstValue_; + } + /** + * + * + *
+     * The offset of the first entry in the encoded data, or, if only a single
+     * integer was encoded, that single integer's value. If the field is empty or
+     * missing, assume zero.
+     * 
+ * + * int64 first_value = 1; + * + * @param value The firstValue to set. + * @return This builder for chaining. + */ + public Builder setFirstValue(long value) { + + firstValue_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The offset of the first entry in the encoded data, or, if only a single
+     * integer was encoded, that single integer's value. If the field is empty or
+     * missing, assume zero.
+     * 
+ * + * int64 first_value = 1; + * + * @return This builder for chaining. + */ + public Builder clearFirstValue() { + + firstValue_ = 0L; + onChanged(); + return this; + } + + private int riceParameter_; + /** + * + * + *
+     * The Golomb-Rice parameter, which is a number between 2 and 28. This field
+     * is missing (that is, zero) if `num_entries` is zero.
+     * 
+ * + * int32 rice_parameter = 2; + * + * @return The riceParameter. + */ + public int getRiceParameter() { + return riceParameter_; + } + /** + * + * + *
+     * The Golomb-Rice parameter, which is a number between 2 and 28. This field
+     * is missing (that is, zero) if `num_entries` is zero.
+     * 
+ * + * int32 rice_parameter = 2; + * + * @param value The riceParameter to set. + * @return This builder for chaining. + */ + public Builder setRiceParameter(int value) { + + riceParameter_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The Golomb-Rice parameter, which is a number between 2 and 28. This field
+     * is missing (that is, zero) if `num_entries` is zero.
+     * 
+ * + * int32 rice_parameter = 2; + * + * @return This builder for chaining. + */ + public Builder clearRiceParameter() { + + riceParameter_ = 0; + onChanged(); + return this; + } + + private int entryCount_; + /** + * + * + *
+     * The number of entries that are delta encoded in the encoded data. If only a
+     * single integer was encoded, this will be zero and the single value will be
+     * stored in `first_value`.
+     * 
+ * + * int32 entry_count = 3; + * + * @return The entryCount. + */ + public int getEntryCount() { + return entryCount_; + } + /** + * + * + *
+     * The number of entries that are delta encoded in the encoded data. If only a
+     * single integer was encoded, this will be zero and the single value will be
+     * stored in `first_value`.
+     * 
+ * + * int32 entry_count = 3; + * + * @param value The entryCount to set. + * @return This builder for chaining. + */ + public Builder setEntryCount(int value) { + + entryCount_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The number of entries that are delta encoded in the encoded data. If only a
+     * single integer was encoded, this will be zero and the single value will be
+     * stored in `first_value`.
+     * 
+ * + * int32 entry_count = 3; + * + * @return This builder for chaining. + */ + public Builder clearEntryCount() { + + entryCount_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.ByteString encodedData_ = com.google.protobuf.ByteString.EMPTY; + /** + * + * + *
+     * The encoded deltas that are encoded using the Golomb-Rice coder.
+     * 
+ * + * bytes encoded_data = 4; + * + * @return The encodedData. + */ + public com.google.protobuf.ByteString getEncodedData() { + return encodedData_; + } + /** + * + * + *
+     * The encoded deltas that are encoded using the Golomb-Rice coder.
+     * 
+ * + * bytes encoded_data = 4; + * + * @param value The encodedData to set. + * @return This builder for chaining. + */ + public Builder setEncodedData(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + + encodedData_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The encoded deltas that are encoded using the Golomb-Rice coder.
+     * 
+ * + * bytes encoded_data = 4; + * + * @return This builder for chaining. + */ + public Builder clearEncodedData() { + + encodedData_ = getDefaultInstance().getEncodedData(); + 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.RiceDeltaEncoding) + } + + // @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.RiceDeltaEncoding) + private static final com.google.webrisk.v1.RiceDeltaEncoding DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.webrisk.v1.RiceDeltaEncoding(); + } + + public static com.google.webrisk.v1.RiceDeltaEncoding getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public RiceDeltaEncoding parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new RiceDeltaEncoding(input, extensionRegistry); + } + }; + + 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.RiceDeltaEncoding getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/RiceDeltaEncodingOrBuilder.java b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/RiceDeltaEncodingOrBuilder.java new file mode 100644 index 00000000..7d049251 --- /dev/null +++ b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/RiceDeltaEncodingOrBuilder.java @@ -0,0 +1,82 @@ +/* + * 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 RiceDeltaEncodingOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.webrisk.v1.RiceDeltaEncoding) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The offset of the first entry in the encoded data, or, if only a single
+   * integer was encoded, that single integer's value. If the field is empty or
+   * missing, assume zero.
+   * 
+ * + * int64 first_value = 1; + * + * @return The firstValue. + */ + long getFirstValue(); + + /** + * + * + *
+   * The Golomb-Rice parameter, which is a number between 2 and 28. This field
+   * is missing (that is, zero) if `num_entries` is zero.
+   * 
+ * + * int32 rice_parameter = 2; + * + * @return The riceParameter. + */ + int getRiceParameter(); + + /** + * + * + *
+   * The number of entries that are delta encoded in the encoded data. If only a
+   * single integer was encoded, this will be zero and the single value will be
+   * stored in `first_value`.
+   * 
+ * + * int32 entry_count = 3; + * + * @return The entryCount. + */ + int getEntryCount(); + + /** + * + * + *
+   * The encoded deltas that are encoded using the Golomb-Rice coder.
+   * 
+ * + * bytes encoded_data = 4; + * + * @return The encodedData. + */ + com.google.protobuf.ByteString getEncodedData(); +} diff --git a/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchHashesRequest.java b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchHashesRequest.java new file mode 100644 index 00000000..3c772b8e --- /dev/null +++ b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchHashesRequest.java @@ -0,0 +1,971 @@ +/* + * 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 return full hashes matched by the provided hash prefixes.
+ * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.SearchHashesRequest} + */ +public final class SearchHashesRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.webrisk.v1.SearchHashesRequest) + SearchHashesRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use SearchHashesRequest.newBuilder() to construct. + private SearchHashesRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private SearchHashesRequest() { + hashPrefix_ = com.google.protobuf.ByteString.EMPTY; + threatTypes_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new SearchHashesRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private SearchHashesRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + hashPrefix_ = input.readBytes(); + break; + } + case 16: + { + int rawValue = input.readEnum(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + threatTypes_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + threatTypes_.add(rawValue); + break; + } + case 18: + { + int length = input.readRawVarint32(); + int oldLimit = input.pushLimit(length); + while (input.getBytesUntilLimit() > 0) { + int rawValue = input.readEnum(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + threatTypes_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + threatTypes_.add(rawValue); + } + input.popLimit(oldLimit); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + threatTypes_ = java.util.Collections.unmodifiableList(threatTypes_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SearchHashesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SearchHashesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.SearchHashesRequest.class, + com.google.webrisk.v1.SearchHashesRequest.Builder.class); + } + + public static final int HASH_PREFIX_FIELD_NUMBER = 1; + private com.google.protobuf.ByteString hashPrefix_; + /** + * + * + *
+   * A hash prefix, consisting of the most significant 4-32 bytes of a SHA256
+   * hash. For JSON requests, this field is base64-encoded.
+   * 
+ * + * bytes hash_prefix = 1; + * + * @return The hashPrefix. + */ + public com.google.protobuf.ByteString getHashPrefix() { + return hashPrefix_; + } + + public static final int THREAT_TYPES_FIELD_NUMBER = 2; + 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) { + @SuppressWarnings("deprecation") + com.google.webrisk.v1.ThreatType result = + com.google.webrisk.v1.ThreatType.valueOf(from); + return result == null ? com.google.webrisk.v1.ThreatType.UNRECOGNIZED : result; + } + }; + /** + * + * + *
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @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_); + } + /** + * + * + *
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The count of threatTypes. + */ + public int getThreatTypesCount() { + return threatTypes_.size(); + } + /** + * + * + *
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @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)); + } + /** + * + * + *
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return A list containing the enum numeric values on the wire for threatTypes. + */ + public java.util.List getThreatTypesValueList() { + return threatTypes_; + } + /** + * + * + *
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @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); + } + + private int threatTypesMemoizedSerializedSize; + + 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 (!hashPrefix_.isEmpty()) { + output.writeBytes(1, hashPrefix_); + } + if (getThreatTypesList().size() > 0) { + output.writeUInt32NoTag(18); + output.writeUInt32NoTag(threatTypesMemoizedSerializedSize); + } + for (int i = 0; i < threatTypes_.size(); i++) { + output.writeEnumNoTag(threatTypes_.get(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!hashPrefix_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream.computeBytesSize(1, hashPrefix_); + } + { + 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 += unknownFields.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.SearchHashesRequest)) { + return super.equals(obj); + } + com.google.webrisk.v1.SearchHashesRequest other = + (com.google.webrisk.v1.SearchHashesRequest) obj; + + if (!getHashPrefix().equals(other.getHashPrefix())) return false; + if (!threatTypes_.equals(other.threatTypes_)) return false; + if (!unknownFields.equals(other.unknownFields)) 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) + HASH_PREFIX_FIELD_NUMBER; + hash = (53 * hash) + getHashPrefix().hashCode(); + if (getThreatTypesCount() > 0) { + hash = (37 * hash) + THREAT_TYPES_FIELD_NUMBER; + hash = (53 * hash) + threatTypes_.hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.webrisk.v1.SearchHashesRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.SearchHashesRequest 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.SearchHashesRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.SearchHashesRequest 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.SearchHashesRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.SearchHashesRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.SearchHashesRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.SearchHashesRequest 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.SearchHashesRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.SearchHashesRequest 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.SearchHashesRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.SearchHashesRequest 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.SearchHashesRequest 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 return full hashes matched by the provided hash prefixes.
+   * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.SearchHashesRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.webrisk.v1.SearchHashesRequest) + com.google.webrisk.v1.SearchHashesRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SearchHashesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SearchHashesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.SearchHashesRequest.class, + com.google.webrisk.v1.SearchHashesRequest.Builder.class); + } + + // Construct using com.google.webrisk.v1.SearchHashesRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + hashPrefix_ = com.google.protobuf.ByteString.EMPTY; + + threatTypes_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SearchHashesRequest_descriptor; + } + + @java.lang.Override + public com.google.webrisk.v1.SearchHashesRequest getDefaultInstanceForType() { + return com.google.webrisk.v1.SearchHashesRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.webrisk.v1.SearchHashesRequest build() { + com.google.webrisk.v1.SearchHashesRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.webrisk.v1.SearchHashesRequest buildPartial() { + com.google.webrisk.v1.SearchHashesRequest result = + new com.google.webrisk.v1.SearchHashesRequest(this); + int from_bitField0_ = bitField0_; + result.hashPrefix_ = hashPrefix_; + if (((bitField0_ & 0x00000001) != 0)) { + threatTypes_ = java.util.Collections.unmodifiableList(threatTypes_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.threatTypes_ = threatTypes_; + onBuilt(); + return result; + } + + @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.SearchHashesRequest) { + return mergeFrom((com.google.webrisk.v1.SearchHashesRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.webrisk.v1.SearchHashesRequest other) { + if (other == com.google.webrisk.v1.SearchHashesRequest.getDefaultInstance()) return this; + if (other.getHashPrefix() != com.google.protobuf.ByteString.EMPTY) { + setHashPrefix(other.getHashPrefix()); + } + if (!other.threatTypes_.isEmpty()) { + if (threatTypes_.isEmpty()) { + threatTypes_ = other.threatTypes_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureThreatTypesIsMutable(); + threatTypes_.addAll(other.threatTypes_); + } + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.webrisk.v1.SearchHashesRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.webrisk.v1.SearchHashesRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private com.google.protobuf.ByteString hashPrefix_ = com.google.protobuf.ByteString.EMPTY; + /** + * + * + *
+     * A hash prefix, consisting of the most significant 4-32 bytes of a SHA256
+     * hash. For JSON requests, this field is base64-encoded.
+     * 
+ * + * bytes hash_prefix = 1; + * + * @return The hashPrefix. + */ + public com.google.protobuf.ByteString getHashPrefix() { + return hashPrefix_; + } + /** + * + * + *
+     * A hash prefix, consisting of the most significant 4-32 bytes of a SHA256
+     * hash. For JSON requests, this field is base64-encoded.
+     * 
+ * + * bytes hash_prefix = 1; + * + * @param value The hashPrefix to set. + * @return This builder for chaining. + */ + public Builder setHashPrefix(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + + hashPrefix_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A hash prefix, consisting of the most significant 4-32 bytes of a SHA256
+     * hash. For JSON requests, this field is base64-encoded.
+     * 
+ * + * bytes hash_prefix = 1; + * + * @return This builder for chaining. + */ + public Builder clearHashPrefix() { + + hashPrefix_ = getDefaultInstance().getHashPrefix(); + onChanged(); + return this; + } + + private java.util.List threatTypes_ = java.util.Collections.emptyList(); + + private void ensureThreatTypesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + threatTypes_ = new java.util.ArrayList(threatTypes_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @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_); + } + /** + * + * + *
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The count of threatTypes. + */ + public int getThreatTypesCount() { + return threatTypes_.size(); + } + /** + * + * + *
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @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)); + } + /** + * + * + *
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @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; + } + /** + * + * + *
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @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; + } + /** + * + * + *
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @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; + } + /** + * + * + *
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return This builder for chaining. + */ + public Builder clearThreatTypes() { + threatTypes_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return A list containing the enum numeric values on the wire for threatTypes. + */ + public java.util.List getThreatTypesValueList() { + return java.util.Collections.unmodifiableList(threatTypes_); + } + /** + * + * + *
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @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); + } + /** + * + * + *
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of threatTypes at the given index. + * @return This builder for chaining. + */ + public Builder setThreatTypesValue(int index, int value) { + ensureThreatTypesIsMutable(); + threatTypes_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @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; + } + /** + * + * + *
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @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); + } + + @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.SearchHashesRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.SearchHashesRequest) + private static final com.google.webrisk.v1.SearchHashesRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.webrisk.v1.SearchHashesRequest(); + } + + public static com.google.webrisk.v1.SearchHashesRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SearchHashesRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new SearchHashesRequest(input, extensionRegistry); + } + }; + + 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.SearchHashesRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchHashesRequestOrBuilder.java b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchHashesRequestOrBuilder.java new file mode 100644 index 00000000..d9ea55b5 --- /dev/null +++ b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchHashesRequestOrBuilder.java @@ -0,0 +1,112 @@ +/* + * 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 SearchHashesRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.webrisk.v1.SearchHashesRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * A hash prefix, consisting of the most significant 4-32 bytes of a SHA256
+   * hash. For JSON requests, this field is base64-encoded.
+   * 
+ * + * bytes hash_prefix = 1; + * + * @return The hashPrefix. + */ + com.google.protobuf.ByteString getHashPrefix(); + + /** + * + * + *
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return A list containing the threatTypes. + */ + java.util.List getThreatTypesList(); + /** + * + * + *
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The count of threatTypes. + */ + int getThreatTypesCount(); + /** + * + * + *
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @param index The index of the element to return. + * @return The threatTypes at the given index. + */ + com.google.webrisk.v1.ThreatType getThreatTypes(int index); + /** + * + * + *
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return A list containing the enum numeric values on the wire for threatTypes. + */ + java.util.List getThreatTypesValueList(); + /** + * + * + *
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @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/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchHashesResponse.java b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchHashesResponse.java new file mode 100644 index 00000000..ad1d5497 --- /dev/null +++ b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchHashesResponse.java @@ -0,0 +1,2601 @@ +/* + * 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; + +/** Protobuf type {@code google.cloud.webrisk.v1.SearchHashesResponse} */ +public final class SearchHashesResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.webrisk.v1.SearchHashesResponse) + SearchHashesResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use SearchHashesResponse.newBuilder() to construct. + private SearchHashesResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private SearchHashesResponse() { + threats_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new SearchHashesResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private SearchHashesResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + threats_ = + new java.util.ArrayList< + com.google.webrisk.v1.SearchHashesResponse.ThreatHash>(); + mutable_bitField0_ |= 0x00000001; + } + threats_.add( + input.readMessage( + com.google.webrisk.v1.SearchHashesResponse.ThreatHash.parser(), + extensionRegistry)); + break; + } + case 18: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (negativeExpireTime_ != null) { + subBuilder = negativeExpireTime_.toBuilder(); + } + negativeExpireTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(negativeExpireTime_); + negativeExpireTime_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + threats_ = java.util.Collections.unmodifiableList(threats_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SearchHashesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SearchHashesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.SearchHashesResponse.class, + com.google.webrisk.v1.SearchHashesResponse.Builder.class); + } + + public interface ThreatHashOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * The ThreatList this threat belongs to.
+     * This must contain at least one entry.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @return A list containing the threatTypes. + */ + java.util.List getThreatTypesList(); + /** + * + * + *
+     * The ThreatList this threat belongs to.
+     * This must contain at least one entry.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @return The count of threatTypes. + */ + int getThreatTypesCount(); + /** + * + * + *
+     * The ThreatList this threat belongs to.
+     * This must contain at least one entry.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @param index The index of the element to return. + * @return The threatTypes at the given index. + */ + com.google.webrisk.v1.ThreatType getThreatTypes(int index); + /** + * + * + *
+     * The ThreatList this threat belongs to.
+     * This must contain at least one entry.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @return A list containing the enum numeric values on the wire for threatTypes. + */ + java.util.List getThreatTypesValueList(); + /** + * + * + *
+     * The ThreatList this threat belongs to.
+     * This must contain at least one entry.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @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); + + /** + * + * + *
+     * A 32 byte SHA256 hash. This field is in binary format. For JSON
+     * requests, hashes are base64-encoded.
+     * 
+ * + * bytes hash = 2; + * + * @return The hash. + */ + com.google.protobuf.ByteString getHash(); + + /** + * + * + *
+     * The cache lifetime for the returned match. Clients must not cache this
+     * response past this timestamp to avoid false positives.
+     * 
+ * + * .google.protobuf.Timestamp expire_time = 3; + * + * @return Whether the expireTime field is set. + */ + boolean hasExpireTime(); + /** + * + * + *
+     * The cache lifetime for the returned match. Clients must not cache this
+     * response past this timestamp to avoid false positives.
+     * 
+ * + * .google.protobuf.Timestamp expire_time = 3; + * + * @return The expireTime. + */ + com.google.protobuf.Timestamp getExpireTime(); + /** + * + * + *
+     * The cache lifetime for the returned match. Clients must not cache this
+     * response past this timestamp to avoid false positives.
+     * 
+ * + * .google.protobuf.Timestamp expire_time = 3; + */ + com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder(); + } + /** + * + * + *
+   * Contains threat information on a matching hash.
+   * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash} + */ + public static final class ThreatHash extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash) + ThreatHashOrBuilder { + private static final long serialVersionUID = 0L; + // Use ThreatHash.newBuilder() to construct. + private ThreatHash(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ThreatHash() { + threatTypes_ = java.util.Collections.emptyList(); + hash_ = com.google.protobuf.ByteString.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ThreatHash(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ThreatHash( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + int rawValue = input.readEnum(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + threatTypes_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + threatTypes_.add(rawValue); + break; + } + case 10: + { + int length = input.readRawVarint32(); + int oldLimit = input.pushLimit(length); + while (input.getBytesUntilLimit() > 0) { + int rawValue = input.readEnum(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + threatTypes_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + threatTypes_.add(rawValue); + } + input.popLimit(oldLimit); + break; + } + case 18: + { + hash_ = input.readBytes(); + break; + } + case 26: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (expireTime_ != null) { + subBuilder = expireTime_.toBuilder(); + } + expireTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(expireTime_); + expireTime_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + threatTypes_ = java.util.Collections.unmodifiableList(threatTypes_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SearchHashesResponse_ThreatHash_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SearchHashesResponse_ThreatHash_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.SearchHashesResponse.ThreatHash.class, + com.google.webrisk.v1.SearchHashesResponse.ThreatHash.Builder.class); + } + + public static final int THREAT_TYPES_FIELD_NUMBER = 1; + 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) { + @SuppressWarnings("deprecation") + com.google.webrisk.v1.ThreatType result = + com.google.webrisk.v1.ThreatType.valueOf(from); + return result == null ? com.google.webrisk.v1.ThreatType.UNRECOGNIZED : result; + } + }; + /** + * + * + *
+     * The ThreatList this threat belongs to.
+     * This must contain at least one entry.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @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_); + } + /** + * + * + *
+     * The ThreatList this threat belongs to.
+     * This must contain at least one entry.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @return The count of threatTypes. + */ + public int getThreatTypesCount() { + return threatTypes_.size(); + } + /** + * + * + *
+     * The ThreatList this threat belongs to.
+     * This must contain at least one entry.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @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)); + } + /** + * + * + *
+     * The ThreatList this threat belongs to.
+     * This must contain at least one entry.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @return A list containing the enum numeric values on the wire for threatTypes. + */ + public java.util.List getThreatTypesValueList() { + return threatTypes_; + } + /** + * + * + *
+     * The ThreatList this threat belongs to.
+     * This must contain at least one entry.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @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); + } + + private int threatTypesMemoizedSerializedSize; + + public static final int HASH_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString hash_; + /** + * + * + *
+     * A 32 byte SHA256 hash. This field is in binary format. For JSON
+     * requests, hashes are base64-encoded.
+     * 
+ * + * bytes hash = 2; + * + * @return The hash. + */ + public com.google.protobuf.ByteString getHash() { + return hash_; + } + + public static final int EXPIRE_TIME_FIELD_NUMBER = 3; + private com.google.protobuf.Timestamp expireTime_; + /** + * + * + *
+     * The cache lifetime for the returned match. Clients must not cache this
+     * response past this timestamp to avoid false positives.
+     * 
+ * + * .google.protobuf.Timestamp expire_time = 3; + * + * @return Whether the expireTime field is set. + */ + public boolean hasExpireTime() { + return expireTime_ != null; + } + /** + * + * + *
+     * The cache lifetime for the returned match. Clients must not cache this
+     * response past this timestamp to avoid false positives.
+     * 
+ * + * .google.protobuf.Timestamp expire_time = 3; + * + * @return The expireTime. + */ + public com.google.protobuf.Timestamp getExpireTime() { + return expireTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : expireTime_; + } + /** + * + * + *
+     * The cache lifetime for the returned match. Clients must not cache this
+     * response past this timestamp to avoid false positives.
+     * 
+ * + * .google.protobuf.Timestamp expire_time = 3; + */ + public com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder() { + return getExpireTime(); + } + + 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 (getThreatTypesList().size() > 0) { + output.writeUInt32NoTag(10); + output.writeUInt32NoTag(threatTypesMemoizedSerializedSize); + } + for (int i = 0; i < threatTypes_.size(); i++) { + output.writeEnumNoTag(threatTypes_.get(i)); + } + if (!hash_.isEmpty()) { + output.writeBytes(2, hash_); + } + if (expireTime_ != null) { + output.writeMessage(3, getExpireTime()); + } + unknownFields.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 < 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; + } + if (!hash_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream.computeBytesSize(2, hash_); + } + if (expireTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getExpireTime()); + } + size += unknownFields.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.SearchHashesResponse.ThreatHash)) { + return super.equals(obj); + } + com.google.webrisk.v1.SearchHashesResponse.ThreatHash other = + (com.google.webrisk.v1.SearchHashesResponse.ThreatHash) obj; + + if (!threatTypes_.equals(other.threatTypes_)) return false; + if (!getHash().equals(other.getHash())) return false; + if (hasExpireTime() != other.hasExpireTime()) return false; + if (hasExpireTime()) { + if (!getExpireTime().equals(other.getExpireTime())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getThreatTypesCount() > 0) { + hash = (37 * hash) + THREAT_TYPES_FIELD_NUMBER; + hash = (53 * hash) + threatTypes_.hashCode(); + } + hash = (37 * hash) + HASH_FIELD_NUMBER; + hash = (53 * hash) + getHash().hashCode(); + if (hasExpireTime()) { + hash = (37 * hash) + EXPIRE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getExpireTime().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.webrisk.v1.SearchHashesResponse.ThreatHash parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.SearchHashesResponse.ThreatHash 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.SearchHashesResponse.ThreatHash parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.SearchHashesResponse.ThreatHash 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.SearchHashesResponse.ThreatHash parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.SearchHashesResponse.ThreatHash parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.SearchHashesResponse.ThreatHash parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.SearchHashesResponse.ThreatHash 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.SearchHashesResponse.ThreatHash parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.SearchHashesResponse.ThreatHash 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.SearchHashesResponse.ThreatHash parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.SearchHashesResponse.ThreatHash 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.SearchHashesResponse.ThreatHash 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; + } + /** + * + * + *
+     * Contains threat information on a matching hash.
+     * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash) + com.google.webrisk.v1.SearchHashesResponse.ThreatHashOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SearchHashesResponse_ThreatHash_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SearchHashesResponse_ThreatHash_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.SearchHashesResponse.ThreatHash.class, + com.google.webrisk.v1.SearchHashesResponse.ThreatHash.Builder.class); + } + + // Construct using com.google.webrisk.v1.SearchHashesResponse.ThreatHash.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + threatTypes_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + hash_ = com.google.protobuf.ByteString.EMPTY; + + if (expireTimeBuilder_ == null) { + expireTime_ = null; + } else { + expireTime_ = null; + expireTimeBuilder_ = 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_SearchHashesResponse_ThreatHash_descriptor; + } + + @java.lang.Override + public com.google.webrisk.v1.SearchHashesResponse.ThreatHash getDefaultInstanceForType() { + return com.google.webrisk.v1.SearchHashesResponse.ThreatHash.getDefaultInstance(); + } + + @java.lang.Override + public com.google.webrisk.v1.SearchHashesResponse.ThreatHash build() { + com.google.webrisk.v1.SearchHashesResponse.ThreatHash result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.webrisk.v1.SearchHashesResponse.ThreatHash buildPartial() { + com.google.webrisk.v1.SearchHashesResponse.ThreatHash result = + new com.google.webrisk.v1.SearchHashesResponse.ThreatHash(this); + int from_bitField0_ = bitField0_; + if (((bitField0_ & 0x00000001) != 0)) { + threatTypes_ = java.util.Collections.unmodifiableList(threatTypes_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.threatTypes_ = threatTypes_; + result.hash_ = hash_; + if (expireTimeBuilder_ == null) { + result.expireTime_ = expireTime_; + } else { + result.expireTime_ = expireTimeBuilder_.build(); + } + onBuilt(); + return result; + } + + @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.SearchHashesResponse.ThreatHash) { + return mergeFrom((com.google.webrisk.v1.SearchHashesResponse.ThreatHash) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.webrisk.v1.SearchHashesResponse.ThreatHash other) { + if (other == com.google.webrisk.v1.SearchHashesResponse.ThreatHash.getDefaultInstance()) + return this; + if (!other.threatTypes_.isEmpty()) { + if (threatTypes_.isEmpty()) { + threatTypes_ = other.threatTypes_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureThreatTypesIsMutable(); + threatTypes_.addAll(other.threatTypes_); + } + onChanged(); + } + if (other.getHash() != com.google.protobuf.ByteString.EMPTY) { + setHash(other.getHash()); + } + if (other.hasExpireTime()) { + mergeExpireTime(other.getExpireTime()); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.webrisk.v1.SearchHashesResponse.ThreatHash parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.webrisk.v1.SearchHashesResponse.ThreatHash) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List threatTypes_ = java.util.Collections.emptyList(); + + private void ensureThreatTypesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + threatTypes_ = new java.util.ArrayList(threatTypes_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+       * The ThreatList this threat belongs to.
+       * This must contain at least one entry.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @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_); + } + /** + * + * + *
+       * The ThreatList this threat belongs to.
+       * This must contain at least one entry.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @return The count of threatTypes. + */ + public int getThreatTypesCount() { + return threatTypes_.size(); + } + /** + * + * + *
+       * The ThreatList this threat belongs to.
+       * This must contain at least one entry.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @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)); + } + /** + * + * + *
+       * The ThreatList this threat belongs to.
+       * This must contain at least one entry.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @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; + } + /** + * + * + *
+       * The ThreatList this threat belongs to.
+       * This must contain at least one entry.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @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; + } + /** + * + * + *
+       * The ThreatList this threat belongs to.
+       * This must contain at least one entry.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @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; + } + /** + * + * + *
+       * The ThreatList this threat belongs to.
+       * This must contain at least one entry.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @return This builder for chaining. + */ + public Builder clearThreatTypes() { + threatTypes_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+       * The ThreatList this threat belongs to.
+       * This must contain at least one entry.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @return A list containing the enum numeric values on the wire for threatTypes. + */ + public java.util.List getThreatTypesValueList() { + return java.util.Collections.unmodifiableList(threatTypes_); + } + /** + * + * + *
+       * The ThreatList this threat belongs to.
+       * This must contain at least one entry.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @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); + } + /** + * + * + *
+       * The ThreatList this threat belongs to.
+       * This must contain at least one entry.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of threatTypes at the given index. + * @return This builder for chaining. + */ + public Builder setThreatTypesValue(int index, int value) { + ensureThreatTypesIsMutable(); + threatTypes_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+       * The ThreatList this threat belongs to.
+       * This must contain at least one entry.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @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; + } + /** + * + * + *
+       * The ThreatList this threat belongs to.
+       * This must contain at least one entry.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @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; + } + + private com.google.protobuf.ByteString hash_ = com.google.protobuf.ByteString.EMPTY; + /** + * + * + *
+       * A 32 byte SHA256 hash. This field is in binary format. For JSON
+       * requests, hashes are base64-encoded.
+       * 
+ * + * bytes hash = 2; + * + * @return The hash. + */ + public com.google.protobuf.ByteString getHash() { + return hash_; + } + /** + * + * + *
+       * A 32 byte SHA256 hash. This field is in binary format. For JSON
+       * requests, hashes are base64-encoded.
+       * 
+ * + * bytes hash = 2; + * + * @param value The hash to set. + * @return This builder for chaining. + */ + public Builder setHash(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + + hash_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * A 32 byte SHA256 hash. This field is in binary format. For JSON
+       * requests, hashes are base64-encoded.
+       * 
+ * + * bytes hash = 2; + * + * @return This builder for chaining. + */ + public Builder clearHash() { + + hash_ = getDefaultInstance().getHash(); + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp expireTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + expireTimeBuilder_; + /** + * + * + *
+       * The cache lifetime for the returned match. Clients must not cache this
+       * response past this timestamp to avoid false positives.
+       * 
+ * + * .google.protobuf.Timestamp expire_time = 3; + * + * @return Whether the expireTime field is set. + */ + public boolean hasExpireTime() { + return expireTimeBuilder_ != null || expireTime_ != null; + } + /** + * + * + *
+       * The cache lifetime for the returned match. Clients must not cache this
+       * response past this timestamp to avoid false positives.
+       * 
+ * + * .google.protobuf.Timestamp expire_time = 3; + * + * @return The expireTime. + */ + public com.google.protobuf.Timestamp getExpireTime() { + if (expireTimeBuilder_ == null) { + return expireTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : expireTime_; + } else { + return expireTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+       * The cache lifetime for the returned match. Clients must not cache this
+       * response past this timestamp to avoid false positives.
+       * 
+ * + * .google.protobuf.Timestamp expire_time = 3; + */ + public Builder setExpireTime(com.google.protobuf.Timestamp value) { + if (expireTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + expireTime_ = value; + onChanged(); + } else { + expireTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+       * The cache lifetime for the returned match. Clients must not cache this
+       * response past this timestamp to avoid false positives.
+       * 
+ * + * .google.protobuf.Timestamp expire_time = 3; + */ + public Builder setExpireTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (expireTimeBuilder_ == null) { + expireTime_ = builderForValue.build(); + onChanged(); + } else { + expireTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+       * The cache lifetime for the returned match. Clients must not cache this
+       * response past this timestamp to avoid false positives.
+       * 
+ * + * .google.protobuf.Timestamp expire_time = 3; + */ + public Builder mergeExpireTime(com.google.protobuf.Timestamp value) { + if (expireTimeBuilder_ == null) { + if (expireTime_ != null) { + expireTime_ = + com.google.protobuf.Timestamp.newBuilder(expireTime_) + .mergeFrom(value) + .buildPartial(); + } else { + expireTime_ = value; + } + onChanged(); + } else { + expireTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+       * The cache lifetime for the returned match. Clients must not cache this
+       * response past this timestamp to avoid false positives.
+       * 
+ * + * .google.protobuf.Timestamp expire_time = 3; + */ + public Builder clearExpireTime() { + if (expireTimeBuilder_ == null) { + expireTime_ = null; + onChanged(); + } else { + expireTime_ = null; + expireTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+       * The cache lifetime for the returned match. Clients must not cache this
+       * response past this timestamp to avoid false positives.
+       * 
+ * + * .google.protobuf.Timestamp expire_time = 3; + */ + public com.google.protobuf.Timestamp.Builder getExpireTimeBuilder() { + + onChanged(); + return getExpireTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+       * The cache lifetime for the returned match. Clients must not cache this
+       * response past this timestamp to avoid false positives.
+       * 
+ * + * .google.protobuf.Timestamp expire_time = 3; + */ + public com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder() { + if (expireTimeBuilder_ != null) { + return expireTimeBuilder_.getMessageOrBuilder(); + } else { + return expireTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : expireTime_; + } + } + /** + * + * + *
+       * The cache lifetime for the returned match. Clients must not cache this
+       * response past this timestamp to avoid false positives.
+       * 
+ * + * .google.protobuf.Timestamp expire_time = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getExpireTimeFieldBuilder() { + if (expireTimeBuilder_ == null) { + expireTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getExpireTime(), getParentForChildren(), isClean()); + expireTime_ = null; + } + return expireTimeBuilder_; + } + + @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.SearchHashesResponse.ThreatHash) + } + + // @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash) + private static final com.google.webrisk.v1.SearchHashesResponse.ThreatHash DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.webrisk.v1.SearchHashesResponse.ThreatHash(); + } + + public static com.google.webrisk.v1.SearchHashesResponse.ThreatHash getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ThreatHash parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ThreatHash(input, extensionRegistry); + } + }; + + 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.SearchHashesResponse.ThreatHash getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public static final int THREATS_FIELD_NUMBER = 1; + private java.util.List threats_; + /** + * + * + *
+   * The full hashes that matched the requested prefixes.
+   * The hash will be populated in the key.
+   * 
+ * + * repeated .google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash threats = 1; + */ + public java.util.List getThreatsList() { + return threats_; + } + /** + * + * + *
+   * The full hashes that matched the requested prefixes.
+   * The hash will be populated in the key.
+   * 
+ * + * repeated .google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash threats = 1; + */ + public java.util.List + getThreatsOrBuilderList() { + return threats_; + } + /** + * + * + *
+   * The full hashes that matched the requested prefixes.
+   * The hash will be populated in the key.
+   * 
+ * + * repeated .google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash threats = 1; + */ + public int getThreatsCount() { + return threats_.size(); + } + /** + * + * + *
+   * The full hashes that matched the requested prefixes.
+   * The hash will be populated in the key.
+   * 
+ * + * repeated .google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash threats = 1; + */ + public com.google.webrisk.v1.SearchHashesResponse.ThreatHash getThreats(int index) { + return threats_.get(index); + } + /** + * + * + *
+   * The full hashes that matched the requested prefixes.
+   * The hash will be populated in the key.
+   * 
+ * + * repeated .google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash threats = 1; + */ + public com.google.webrisk.v1.SearchHashesResponse.ThreatHashOrBuilder getThreatsOrBuilder( + int index) { + return threats_.get(index); + } + + public static final int NEGATIVE_EXPIRE_TIME_FIELD_NUMBER = 2; + private com.google.protobuf.Timestamp negativeExpireTime_; + /** + * + * + *
+   * For requested entities that did not match the threat list, how long to
+   * cache the response until.
+   * 
+ * + * .google.protobuf.Timestamp negative_expire_time = 2; + * + * @return Whether the negativeExpireTime field is set. + */ + public boolean hasNegativeExpireTime() { + return negativeExpireTime_ != null; + } + /** + * + * + *
+   * For requested entities that did not match the threat list, how long to
+   * cache the response until.
+   * 
+ * + * .google.protobuf.Timestamp negative_expire_time = 2; + * + * @return The negativeExpireTime. + */ + public com.google.protobuf.Timestamp getNegativeExpireTime() { + return negativeExpireTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : negativeExpireTime_; + } + /** + * + * + *
+   * For requested entities that did not match the threat list, how long to
+   * cache the response until.
+   * 
+ * + * .google.protobuf.Timestamp negative_expire_time = 2; + */ + public com.google.protobuf.TimestampOrBuilder getNegativeExpireTimeOrBuilder() { + return getNegativeExpireTime(); + } + + 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 { + for (int i = 0; i < threats_.size(); i++) { + output.writeMessage(1, threats_.get(i)); + } + if (negativeExpireTime_ != null) { + output.writeMessage(2, getNegativeExpireTime()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < threats_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, threats_.get(i)); + } + if (negativeExpireTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getNegativeExpireTime()); + } + size += unknownFields.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.SearchHashesResponse)) { + return super.equals(obj); + } + com.google.webrisk.v1.SearchHashesResponse other = + (com.google.webrisk.v1.SearchHashesResponse) obj; + + if (!getThreatsList().equals(other.getThreatsList())) return false; + if (hasNegativeExpireTime() != other.hasNegativeExpireTime()) return false; + if (hasNegativeExpireTime()) { + if (!getNegativeExpireTime().equals(other.getNegativeExpireTime())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getThreatsCount() > 0) { + hash = (37 * hash) + THREATS_FIELD_NUMBER; + hash = (53 * hash) + getThreatsList().hashCode(); + } + if (hasNegativeExpireTime()) { + hash = (37 * hash) + NEGATIVE_EXPIRE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getNegativeExpireTime().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.webrisk.v1.SearchHashesResponse parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.SearchHashesResponse 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.SearchHashesResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.SearchHashesResponse 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.SearchHashesResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.SearchHashesResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.SearchHashesResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.SearchHashesResponse 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.SearchHashesResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.SearchHashesResponse 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.SearchHashesResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.SearchHashesResponse 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.SearchHashesResponse 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; + } + /** Protobuf type {@code google.cloud.webrisk.v1.SearchHashesResponse} */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.webrisk.v1.SearchHashesResponse) + com.google.webrisk.v1.SearchHashesResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SearchHashesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SearchHashesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.SearchHashesResponse.class, + com.google.webrisk.v1.SearchHashesResponse.Builder.class); + } + + // Construct using com.google.webrisk.v1.SearchHashesResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getThreatsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (threatsBuilder_ == null) { + threats_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + threatsBuilder_.clear(); + } + if (negativeExpireTimeBuilder_ == null) { + negativeExpireTime_ = null; + } else { + negativeExpireTime_ = null; + negativeExpireTimeBuilder_ = 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_SearchHashesResponse_descriptor; + } + + @java.lang.Override + public com.google.webrisk.v1.SearchHashesResponse getDefaultInstanceForType() { + return com.google.webrisk.v1.SearchHashesResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.webrisk.v1.SearchHashesResponse build() { + com.google.webrisk.v1.SearchHashesResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.webrisk.v1.SearchHashesResponse buildPartial() { + com.google.webrisk.v1.SearchHashesResponse result = + new com.google.webrisk.v1.SearchHashesResponse(this); + int from_bitField0_ = bitField0_; + if (threatsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + threats_ = java.util.Collections.unmodifiableList(threats_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.threats_ = threats_; + } else { + result.threats_ = threatsBuilder_.build(); + } + if (negativeExpireTimeBuilder_ == null) { + result.negativeExpireTime_ = negativeExpireTime_; + } else { + result.negativeExpireTime_ = negativeExpireTimeBuilder_.build(); + } + onBuilt(); + return result; + } + + @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.SearchHashesResponse) { + return mergeFrom((com.google.webrisk.v1.SearchHashesResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.webrisk.v1.SearchHashesResponse other) { + if (other == com.google.webrisk.v1.SearchHashesResponse.getDefaultInstance()) return this; + if (threatsBuilder_ == null) { + if (!other.threats_.isEmpty()) { + if (threats_.isEmpty()) { + threats_ = other.threats_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureThreatsIsMutable(); + threats_.addAll(other.threats_); + } + onChanged(); + } + } else { + if (!other.threats_.isEmpty()) { + if (threatsBuilder_.isEmpty()) { + threatsBuilder_.dispose(); + threatsBuilder_ = null; + threats_ = other.threats_; + bitField0_ = (bitField0_ & ~0x00000001); + threatsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getThreatsFieldBuilder() + : null; + } else { + threatsBuilder_.addAllMessages(other.threats_); + } + } + } + if (other.hasNegativeExpireTime()) { + mergeNegativeExpireTime(other.getNegativeExpireTime()); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.webrisk.v1.SearchHashesResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.webrisk.v1.SearchHashesResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List threats_ = + java.util.Collections.emptyList(); + + private void ensureThreatsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + threats_ = + new java.util.ArrayList( + threats_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.webrisk.v1.SearchHashesResponse.ThreatHash, + com.google.webrisk.v1.SearchHashesResponse.ThreatHash.Builder, + com.google.webrisk.v1.SearchHashesResponse.ThreatHashOrBuilder> + threatsBuilder_; + + /** + * + * + *
+     * The full hashes that matched the requested prefixes.
+     * The hash will be populated in the key.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash threats = 1; + */ + public java.util.List getThreatsList() { + if (threatsBuilder_ == null) { + return java.util.Collections.unmodifiableList(threats_); + } else { + return threatsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * The full hashes that matched the requested prefixes.
+     * The hash will be populated in the key.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash threats = 1; + */ + public int getThreatsCount() { + if (threatsBuilder_ == null) { + return threats_.size(); + } else { + return threatsBuilder_.getCount(); + } + } + /** + * + * + *
+     * The full hashes that matched the requested prefixes.
+     * The hash will be populated in the key.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash threats = 1; + */ + public com.google.webrisk.v1.SearchHashesResponse.ThreatHash getThreats(int index) { + if (threatsBuilder_ == null) { + return threats_.get(index); + } else { + return threatsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * The full hashes that matched the requested prefixes.
+     * The hash will be populated in the key.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash threats = 1; + */ + public Builder setThreats( + int index, com.google.webrisk.v1.SearchHashesResponse.ThreatHash value) { + if (threatsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureThreatsIsMutable(); + threats_.set(index, value); + onChanged(); + } else { + threatsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The full hashes that matched the requested prefixes.
+     * The hash will be populated in the key.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash threats = 1; + */ + public Builder setThreats( + int index, com.google.webrisk.v1.SearchHashesResponse.ThreatHash.Builder builderForValue) { + if (threatsBuilder_ == null) { + ensureThreatsIsMutable(); + threats_.set(index, builderForValue.build()); + onChanged(); + } else { + threatsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The full hashes that matched the requested prefixes.
+     * The hash will be populated in the key.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash threats = 1; + */ + public Builder addThreats(com.google.webrisk.v1.SearchHashesResponse.ThreatHash value) { + if (threatsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureThreatsIsMutable(); + threats_.add(value); + onChanged(); + } else { + threatsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * The full hashes that matched the requested prefixes.
+     * The hash will be populated in the key.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash threats = 1; + */ + public Builder addThreats( + int index, com.google.webrisk.v1.SearchHashesResponse.ThreatHash value) { + if (threatsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureThreatsIsMutable(); + threats_.add(index, value); + onChanged(); + } else { + threatsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The full hashes that matched the requested prefixes.
+     * The hash will be populated in the key.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash threats = 1; + */ + public Builder addThreats( + com.google.webrisk.v1.SearchHashesResponse.ThreatHash.Builder builderForValue) { + if (threatsBuilder_ == null) { + ensureThreatsIsMutable(); + threats_.add(builderForValue.build()); + onChanged(); + } else { + threatsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The full hashes that matched the requested prefixes.
+     * The hash will be populated in the key.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash threats = 1; + */ + public Builder addThreats( + int index, com.google.webrisk.v1.SearchHashesResponse.ThreatHash.Builder builderForValue) { + if (threatsBuilder_ == null) { + ensureThreatsIsMutable(); + threats_.add(index, builderForValue.build()); + onChanged(); + } else { + threatsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The full hashes that matched the requested prefixes.
+     * The hash will be populated in the key.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash threats = 1; + */ + public Builder addAllThreats( + java.lang.Iterable + values) { + if (threatsBuilder_ == null) { + ensureThreatsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, threats_); + onChanged(); + } else { + threatsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * The full hashes that matched the requested prefixes.
+     * The hash will be populated in the key.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash threats = 1; + */ + public Builder clearThreats() { + if (threatsBuilder_ == null) { + threats_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + threatsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The full hashes that matched the requested prefixes.
+     * The hash will be populated in the key.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash threats = 1; + */ + public Builder removeThreats(int index) { + if (threatsBuilder_ == null) { + ensureThreatsIsMutable(); + threats_.remove(index); + onChanged(); + } else { + threatsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * The full hashes that matched the requested prefixes.
+     * The hash will be populated in the key.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash threats = 1; + */ + public com.google.webrisk.v1.SearchHashesResponse.ThreatHash.Builder getThreatsBuilder( + int index) { + return getThreatsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * The full hashes that matched the requested prefixes.
+     * The hash will be populated in the key.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash threats = 1; + */ + public com.google.webrisk.v1.SearchHashesResponse.ThreatHashOrBuilder getThreatsOrBuilder( + int index) { + if (threatsBuilder_ == null) { + return threats_.get(index); + } else { + return threatsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * The full hashes that matched the requested prefixes.
+     * The hash will be populated in the key.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash threats = 1; + */ + public java.util.List + getThreatsOrBuilderList() { + if (threatsBuilder_ != null) { + return threatsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(threats_); + } + } + /** + * + * + *
+     * The full hashes that matched the requested prefixes.
+     * The hash will be populated in the key.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash threats = 1; + */ + public com.google.webrisk.v1.SearchHashesResponse.ThreatHash.Builder addThreatsBuilder() { + return getThreatsFieldBuilder() + .addBuilder(com.google.webrisk.v1.SearchHashesResponse.ThreatHash.getDefaultInstance()); + } + /** + * + * + *
+     * The full hashes that matched the requested prefixes.
+     * The hash will be populated in the key.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash threats = 1; + */ + public com.google.webrisk.v1.SearchHashesResponse.ThreatHash.Builder addThreatsBuilder( + int index) { + return getThreatsFieldBuilder() + .addBuilder( + index, com.google.webrisk.v1.SearchHashesResponse.ThreatHash.getDefaultInstance()); + } + /** + * + * + *
+     * The full hashes that matched the requested prefixes.
+     * The hash will be populated in the key.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash threats = 1; + */ + public java.util.List + getThreatsBuilderList() { + return getThreatsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.webrisk.v1.SearchHashesResponse.ThreatHash, + com.google.webrisk.v1.SearchHashesResponse.ThreatHash.Builder, + com.google.webrisk.v1.SearchHashesResponse.ThreatHashOrBuilder> + getThreatsFieldBuilder() { + if (threatsBuilder_ == null) { + threatsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.webrisk.v1.SearchHashesResponse.ThreatHash, + com.google.webrisk.v1.SearchHashesResponse.ThreatHash.Builder, + com.google.webrisk.v1.SearchHashesResponse.ThreatHashOrBuilder>( + threats_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + threats_ = null; + } + return threatsBuilder_; + } + + private com.google.protobuf.Timestamp negativeExpireTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + negativeExpireTimeBuilder_; + /** + * + * + *
+     * For requested entities that did not match the threat list, how long to
+     * cache the response until.
+     * 
+ * + * .google.protobuf.Timestamp negative_expire_time = 2; + * + * @return Whether the negativeExpireTime field is set. + */ + public boolean hasNegativeExpireTime() { + return negativeExpireTimeBuilder_ != null || negativeExpireTime_ != null; + } + /** + * + * + *
+     * For requested entities that did not match the threat list, how long to
+     * cache the response until.
+     * 
+ * + * .google.protobuf.Timestamp negative_expire_time = 2; + * + * @return The negativeExpireTime. + */ + public com.google.protobuf.Timestamp getNegativeExpireTime() { + if (negativeExpireTimeBuilder_ == null) { + return negativeExpireTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : negativeExpireTime_; + } else { + return negativeExpireTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * For requested entities that did not match the threat list, how long to
+     * cache the response until.
+     * 
+ * + * .google.protobuf.Timestamp negative_expire_time = 2; + */ + public Builder setNegativeExpireTime(com.google.protobuf.Timestamp value) { + if (negativeExpireTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + negativeExpireTime_ = value; + onChanged(); + } else { + negativeExpireTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * For requested entities that did not match the threat list, how long to
+     * cache the response until.
+     * 
+ * + * .google.protobuf.Timestamp negative_expire_time = 2; + */ + public Builder setNegativeExpireTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (negativeExpireTimeBuilder_ == null) { + negativeExpireTime_ = builderForValue.build(); + onChanged(); + } else { + negativeExpireTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * For requested entities that did not match the threat list, how long to
+     * cache the response until.
+     * 
+ * + * .google.protobuf.Timestamp negative_expire_time = 2; + */ + public Builder mergeNegativeExpireTime(com.google.protobuf.Timestamp value) { + if (negativeExpireTimeBuilder_ == null) { + if (negativeExpireTime_ != null) { + negativeExpireTime_ = + com.google.protobuf.Timestamp.newBuilder(negativeExpireTime_) + .mergeFrom(value) + .buildPartial(); + } else { + negativeExpireTime_ = value; + } + onChanged(); + } else { + negativeExpireTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * For requested entities that did not match the threat list, how long to
+     * cache the response until.
+     * 
+ * + * .google.protobuf.Timestamp negative_expire_time = 2; + */ + public Builder clearNegativeExpireTime() { + if (negativeExpireTimeBuilder_ == null) { + negativeExpireTime_ = null; + onChanged(); + } else { + negativeExpireTime_ = null; + negativeExpireTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * For requested entities that did not match the threat list, how long to
+     * cache the response until.
+     * 
+ * + * .google.protobuf.Timestamp negative_expire_time = 2; + */ + public com.google.protobuf.Timestamp.Builder getNegativeExpireTimeBuilder() { + + onChanged(); + return getNegativeExpireTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * For requested entities that did not match the threat list, how long to
+     * cache the response until.
+     * 
+ * + * .google.protobuf.Timestamp negative_expire_time = 2; + */ + public com.google.protobuf.TimestampOrBuilder getNegativeExpireTimeOrBuilder() { + if (negativeExpireTimeBuilder_ != null) { + return negativeExpireTimeBuilder_.getMessageOrBuilder(); + } else { + return negativeExpireTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : negativeExpireTime_; + } + } + /** + * + * + *
+     * For requested entities that did not match the threat list, how long to
+     * cache the response until.
+     * 
+ * + * .google.protobuf.Timestamp negative_expire_time = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getNegativeExpireTimeFieldBuilder() { + if (negativeExpireTimeBuilder_ == null) { + negativeExpireTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getNegativeExpireTime(), getParentForChildren(), isClean()); + negativeExpireTime_ = null; + } + return negativeExpireTimeBuilder_; + } + + @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.SearchHashesResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.SearchHashesResponse) + private static final com.google.webrisk.v1.SearchHashesResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.webrisk.v1.SearchHashesResponse(); + } + + public static com.google.webrisk.v1.SearchHashesResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SearchHashesResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new SearchHashesResponse(input, extensionRegistry); + } + }; + + 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.SearchHashesResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchHashesResponseOrBuilder.java b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchHashesResponseOrBuilder.java new file mode 100644 index 00000000..c7906262 --- /dev/null +++ b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchHashesResponseOrBuilder.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 SearchHashesResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.webrisk.v1.SearchHashesResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The full hashes that matched the requested prefixes.
+   * The hash will be populated in the key.
+   * 
+ * + * repeated .google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash threats = 1; + */ + java.util.List getThreatsList(); + /** + * + * + *
+   * The full hashes that matched the requested prefixes.
+   * The hash will be populated in the key.
+   * 
+ * + * repeated .google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash threats = 1; + */ + com.google.webrisk.v1.SearchHashesResponse.ThreatHash getThreats(int index); + /** + * + * + *
+   * The full hashes that matched the requested prefixes.
+   * The hash will be populated in the key.
+   * 
+ * + * repeated .google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash threats = 1; + */ + int getThreatsCount(); + /** + * + * + *
+   * The full hashes that matched the requested prefixes.
+   * The hash will be populated in the key.
+   * 
+ * + * repeated .google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash threats = 1; + */ + java.util.List + getThreatsOrBuilderList(); + /** + * + * + *
+   * The full hashes that matched the requested prefixes.
+   * The hash will be populated in the key.
+   * 
+ * + * repeated .google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash threats = 1; + */ + com.google.webrisk.v1.SearchHashesResponse.ThreatHashOrBuilder getThreatsOrBuilder(int index); + + /** + * + * + *
+   * For requested entities that did not match the threat list, how long to
+   * cache the response until.
+   * 
+ * + * .google.protobuf.Timestamp negative_expire_time = 2; + * + * @return Whether the negativeExpireTime field is set. + */ + boolean hasNegativeExpireTime(); + /** + * + * + *
+   * For requested entities that did not match the threat list, how long to
+   * cache the response until.
+   * 
+ * + * .google.protobuf.Timestamp negative_expire_time = 2; + * + * @return The negativeExpireTime. + */ + com.google.protobuf.Timestamp getNegativeExpireTime(); + /** + * + * + *
+   * For requested entities that did not match the threat list, how long to
+   * cache the response until.
+   * 
+ * + * .google.protobuf.Timestamp negative_expire_time = 2; + */ + com.google.protobuf.TimestampOrBuilder getNegativeExpireTimeOrBuilder(); +} diff --git a/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchUrisRequest.java b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchUrisRequest.java new file mode 100644 index 00000000..2f032c47 --- /dev/null +++ b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchUrisRequest.java @@ -0,0 +1,1051 @@ +/* + * 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 check URI entries against threatLists.
+ * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.SearchUrisRequest} + */ +public final class SearchUrisRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.webrisk.v1.SearchUrisRequest) + SearchUrisRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use SearchUrisRequest.newBuilder() to construct. + private SearchUrisRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private SearchUrisRequest() { + uri_ = ""; + threatTypes_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new SearchUrisRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private SearchUrisRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + uri_ = s; + break; + } + case 16: + { + int rawValue = input.readEnum(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + threatTypes_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + threatTypes_.add(rawValue); + break; + } + case 18: + { + int length = input.readRawVarint32(); + int oldLimit = input.pushLimit(length); + while (input.getBytesUntilLimit() > 0) { + int rawValue = input.readEnum(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + threatTypes_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + threatTypes_.add(rawValue); + } + input.popLimit(oldLimit); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + threatTypes_ = java.util.Collections.unmodifiableList(threatTypes_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SearchUrisRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SearchUrisRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.SearchUrisRequest.class, + com.google.webrisk.v1.SearchUrisRequest.Builder.class); + } + + public static final int URI_FIELD_NUMBER = 1; + private volatile java.lang.Object uri_; + /** + * + * + *
+   * Required. The URI to be checked for matches.
+   * 
+ * + * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The uri. + */ + public java.lang.String getUri() { + java.lang.Object ref = uri_; + 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(); + uri_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The URI to be checked for matches.
+   * 
+ * + * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for uri. + */ + public com.google.protobuf.ByteString getUriBytes() { + java.lang.Object ref = uri_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int THREAT_TYPES_FIELD_NUMBER = 2; + 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) { + @SuppressWarnings("deprecation") + com.google.webrisk.v1.ThreatType result = + com.google.webrisk.v1.ThreatType.valueOf(from); + return result == null ? com.google.webrisk.v1.ThreatType.UNRECOGNIZED : result; + } + }; + /** + * + * + *
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @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_); + } + /** + * + * + *
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The count of threatTypes. + */ + public int getThreatTypesCount() { + return threatTypes_.size(); + } + /** + * + * + *
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @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)); + } + /** + * + * + *
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return A list containing the enum numeric values on the wire for threatTypes. + */ + public java.util.List getThreatTypesValueList() { + return threatTypes_; + } + /** + * + * + *
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @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); + } + + private int threatTypesMemoizedSerializedSize; + + 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 (!getUriBytes().isEmpty()) { + 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)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getUriBytes().isEmpty()) { + 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 += unknownFields.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.SearchUrisRequest)) { + return super.equals(obj); + } + com.google.webrisk.v1.SearchUrisRequest other = (com.google.webrisk.v1.SearchUrisRequest) obj; + + if (!getUri().equals(other.getUri())) return false; + if (!threatTypes_.equals(other.threatTypes_)) return false; + if (!unknownFields.equals(other.unknownFields)) 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) + 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) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.webrisk.v1.SearchUrisRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.SearchUrisRequest 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.SearchUrisRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.SearchUrisRequest 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.SearchUrisRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.SearchUrisRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.SearchUrisRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.SearchUrisRequest 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.SearchUrisRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.SearchUrisRequest 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.SearchUrisRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.SearchUrisRequest 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.SearchUrisRequest 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 check URI entries against threatLists.
+   * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.SearchUrisRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.webrisk.v1.SearchUrisRequest) + com.google.webrisk.v1.SearchUrisRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SearchUrisRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SearchUrisRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.SearchUrisRequest.class, + com.google.webrisk.v1.SearchUrisRequest.Builder.class); + } + + // Construct using com.google.webrisk.v1.SearchUrisRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + uri_ = ""; + + threatTypes_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SearchUrisRequest_descriptor; + } + + @java.lang.Override + public com.google.webrisk.v1.SearchUrisRequest getDefaultInstanceForType() { + return com.google.webrisk.v1.SearchUrisRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.webrisk.v1.SearchUrisRequest build() { + com.google.webrisk.v1.SearchUrisRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.webrisk.v1.SearchUrisRequest buildPartial() { + com.google.webrisk.v1.SearchUrisRequest result = + new com.google.webrisk.v1.SearchUrisRequest(this); + int from_bitField0_ = bitField0_; + result.uri_ = uri_; + if (((bitField0_ & 0x00000001) != 0)) { + threatTypes_ = java.util.Collections.unmodifiableList(threatTypes_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.threatTypes_ = threatTypes_; + onBuilt(); + return result; + } + + @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.SearchUrisRequest) { + return mergeFrom((com.google.webrisk.v1.SearchUrisRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.webrisk.v1.SearchUrisRequest other) { + if (other == com.google.webrisk.v1.SearchUrisRequest.getDefaultInstance()) return this; + if (!other.getUri().isEmpty()) { + uri_ = other.uri_; + onChanged(); + } + if (!other.threatTypes_.isEmpty()) { + if (threatTypes_.isEmpty()) { + threatTypes_ = other.threatTypes_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureThreatTypesIsMutable(); + threatTypes_.addAll(other.threatTypes_); + } + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.webrisk.v1.SearchUrisRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.webrisk.v1.SearchUrisRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object uri_ = ""; + /** + * + * + *
+     * Required. The URI to be checked for matches.
+     * 
+ * + * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The uri. + */ + public java.lang.String getUri() { + java.lang.Object ref = uri_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uri_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The URI to be checked for matches.
+     * 
+ * + * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for uri. + */ + public com.google.protobuf.ByteString getUriBytes() { + java.lang.Object ref = uri_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The URI to be checked for matches.
+     * 
+ * + * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The uri to set. + * @return This builder for chaining. + */ + public Builder setUri(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + uri_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The URI to be checked for matches.
+     * 
+ * + * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearUri() { + + uri_ = getDefaultInstance().getUri(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The URI to be checked for matches.
+     * 
+ * + * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for uri to set. + * @return This builder for chaining. + */ + public Builder setUriBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + uri_ = value; + onChanged(); + return this; + } + + private java.util.List threatTypes_ = java.util.Collections.emptyList(); + + private void ensureThreatTypesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + threatTypes_ = new java.util.ArrayList(threatTypes_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @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_); + } + /** + * + * + *
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The count of threatTypes. + */ + public int getThreatTypesCount() { + return threatTypes_.size(); + } + /** + * + * + *
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @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)); + } + /** + * + * + *
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @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; + } + /** + * + * + *
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @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; + } + /** + * + * + *
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @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; + } + /** + * + * + *
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return This builder for chaining. + */ + public Builder clearThreatTypes() { + threatTypes_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return A list containing the enum numeric values on the wire for threatTypes. + */ + public java.util.List getThreatTypesValueList() { + return java.util.Collections.unmodifiableList(threatTypes_); + } + /** + * + * + *
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @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); + } + /** + * + * + *
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of threatTypes at the given index. + * @return This builder for chaining. + */ + public Builder setThreatTypesValue(int index, int value) { + ensureThreatTypesIsMutable(); + threatTypes_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @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; + } + /** + * + * + *
+     * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+     * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @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); + } + + @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.SearchUrisRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.SearchUrisRequest) + private static final com.google.webrisk.v1.SearchUrisRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.webrisk.v1.SearchUrisRequest(); + } + + public static com.google.webrisk.v1.SearchUrisRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SearchUrisRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new SearchUrisRequest(input, extensionRegistry); + } + }; + + 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.SearchUrisRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchUrisRequestOrBuilder.java b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchUrisRequestOrBuilder.java new file mode 100644 index 00000000..a49b7bfa --- /dev/null +++ b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchUrisRequestOrBuilder.java @@ -0,0 +1,123 @@ +/* + * 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 SearchUrisRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.webrisk.v1.SearchUrisRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The URI to be checked for matches.
+   * 
+ * + * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The uri. + */ + java.lang.String getUri(); + /** + * + * + *
+   * Required. The URI to be checked for matches.
+   * 
+ * + * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for uri. + */ + com.google.protobuf.ByteString getUriBytes(); + + /** + * + * + *
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return A list containing the threatTypes. + */ + java.util.List getThreatTypesList(); + /** + * + * + *
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The count of threatTypes. + */ + int getThreatTypesCount(); + /** + * + * + *
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @param index The index of the element to return. + * @return The threatTypes at the given index. + */ + com.google.webrisk.v1.ThreatType getThreatTypes(int index); + /** + * + * + *
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return A list containing the enum numeric values on the wire for threatTypes. + */ + java.util.List getThreatTypesValueList(); + /** + * + * + *
+   * Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+   * 
+ * + * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @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/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchUrisResponse.java b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchUrisResponse.java new file mode 100644 index 00000000..5e48cdc9 --- /dev/null +++ b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchUrisResponse.java @@ -0,0 +1,1933 @@ +/* + * 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; + +/** Protobuf type {@code google.cloud.webrisk.v1.SearchUrisResponse} */ +public final class SearchUrisResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.webrisk.v1.SearchUrisResponse) + SearchUrisResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use SearchUrisResponse.newBuilder() to construct. + private SearchUrisResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private SearchUrisResponse() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new SearchUrisResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private SearchUrisResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.webrisk.v1.SearchUrisResponse.ThreatUri.Builder subBuilder = null; + if (threat_ != null) { + subBuilder = threat_.toBuilder(); + } + threat_ = + input.readMessage( + com.google.webrisk.v1.SearchUrisResponse.ThreatUri.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(threat_); + threat_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SearchUrisResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SearchUrisResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.SearchUrisResponse.class, + com.google.webrisk.v1.SearchUrisResponse.Builder.class); + } + + public interface ThreatUriOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * The ThreatList this threat belongs to.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @return A list containing the threatTypes. + */ + java.util.List getThreatTypesList(); + /** + * + * + *
+     * The ThreatList this threat belongs to.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @return The count of threatTypes. + */ + int getThreatTypesCount(); + /** + * + * + *
+     * The ThreatList this threat belongs to.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @param index The index of the element to return. + * @return The threatTypes at the given index. + */ + com.google.webrisk.v1.ThreatType getThreatTypes(int index); + /** + * + * + *
+     * The ThreatList this threat belongs to.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @return A list containing the enum numeric values on the wire for threatTypes. + */ + java.util.List getThreatTypesValueList(); + /** + * + * + *
+     * The ThreatList this threat belongs to.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @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); + + /** + * + * + *
+     * The cache lifetime for the returned match. Clients must not cache this
+     * response past this timestamp to avoid false positives.
+     * 
+ * + * .google.protobuf.Timestamp expire_time = 2; + * + * @return Whether the expireTime field is set. + */ + boolean hasExpireTime(); + /** + * + * + *
+     * The cache lifetime for the returned match. Clients must not cache this
+     * response past this timestamp to avoid false positives.
+     * 
+ * + * .google.protobuf.Timestamp expire_time = 2; + * + * @return The expireTime. + */ + com.google.protobuf.Timestamp getExpireTime(); + /** + * + * + *
+     * The cache lifetime for the returned match. Clients must not cache this
+     * response past this timestamp to avoid false positives.
+     * 
+ * + * .google.protobuf.Timestamp expire_time = 2; + */ + com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder(); + } + /** + * + * + *
+   * Contains threat information on a matching uri.
+   * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri} + */ + public static final class ThreatUri extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri) + ThreatUriOrBuilder { + private static final long serialVersionUID = 0L; + // Use ThreatUri.newBuilder() to construct. + private ThreatUri(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ThreatUri() { + threatTypes_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ThreatUri(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ThreatUri( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + int rawValue = input.readEnum(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + threatTypes_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + threatTypes_.add(rawValue); + break; + } + case 10: + { + int length = input.readRawVarint32(); + int oldLimit = input.pushLimit(length); + while (input.getBytesUntilLimit() > 0) { + int rawValue = input.readEnum(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + threatTypes_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + threatTypes_.add(rawValue); + } + input.popLimit(oldLimit); + break; + } + case 18: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (expireTime_ != null) { + subBuilder = expireTime_.toBuilder(); + } + expireTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(expireTime_); + expireTime_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + threatTypes_ = java.util.Collections.unmodifiableList(threatTypes_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SearchUrisResponse_ThreatUri_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SearchUrisResponse_ThreatUri_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.SearchUrisResponse.ThreatUri.class, + com.google.webrisk.v1.SearchUrisResponse.ThreatUri.Builder.class); + } + + public static final int THREAT_TYPES_FIELD_NUMBER = 1; + 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) { + @SuppressWarnings("deprecation") + com.google.webrisk.v1.ThreatType result = + com.google.webrisk.v1.ThreatType.valueOf(from); + return result == null ? com.google.webrisk.v1.ThreatType.UNRECOGNIZED : result; + } + }; + /** + * + * + *
+     * The ThreatList this threat belongs to.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @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_); + } + /** + * + * + *
+     * The ThreatList this threat belongs to.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @return The count of threatTypes. + */ + public int getThreatTypesCount() { + return threatTypes_.size(); + } + /** + * + * + *
+     * The ThreatList this threat belongs to.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @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)); + } + /** + * + * + *
+     * The ThreatList this threat belongs to.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @return A list containing the enum numeric values on the wire for threatTypes. + */ + public java.util.List getThreatTypesValueList() { + return threatTypes_; + } + /** + * + * + *
+     * The ThreatList this threat belongs to.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @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); + } + + private int threatTypesMemoizedSerializedSize; + + public static final int EXPIRE_TIME_FIELD_NUMBER = 2; + private com.google.protobuf.Timestamp expireTime_; + /** + * + * + *
+     * The cache lifetime for the returned match. Clients must not cache this
+     * response past this timestamp to avoid false positives.
+     * 
+ * + * .google.protobuf.Timestamp expire_time = 2; + * + * @return Whether the expireTime field is set. + */ + public boolean hasExpireTime() { + return expireTime_ != null; + } + /** + * + * + *
+     * The cache lifetime for the returned match. Clients must not cache this
+     * response past this timestamp to avoid false positives.
+     * 
+ * + * .google.protobuf.Timestamp expire_time = 2; + * + * @return The expireTime. + */ + public com.google.protobuf.Timestamp getExpireTime() { + return expireTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : expireTime_; + } + /** + * + * + *
+     * The cache lifetime for the returned match. Clients must not cache this
+     * response past this timestamp to avoid false positives.
+     * 
+ * + * .google.protobuf.Timestamp expire_time = 2; + */ + public com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder() { + return getExpireTime(); + } + + 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 (getThreatTypesList().size() > 0) { + output.writeUInt32NoTag(10); + output.writeUInt32NoTag(threatTypesMemoizedSerializedSize); + } + for (int i = 0; i < threatTypes_.size(); i++) { + output.writeEnumNoTag(threatTypes_.get(i)); + } + if (expireTime_ != null) { + output.writeMessage(2, getExpireTime()); + } + unknownFields.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 < 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; + } + if (expireTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getExpireTime()); + } + size += unknownFields.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.SearchUrisResponse.ThreatUri)) { + return super.equals(obj); + } + com.google.webrisk.v1.SearchUrisResponse.ThreatUri other = + (com.google.webrisk.v1.SearchUrisResponse.ThreatUri) obj; + + if (!threatTypes_.equals(other.threatTypes_)) return false; + if (hasExpireTime() != other.hasExpireTime()) return false; + if (hasExpireTime()) { + if (!getExpireTime().equals(other.getExpireTime())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getThreatTypesCount() > 0) { + hash = (37 * hash) + THREAT_TYPES_FIELD_NUMBER; + hash = (53 * hash) + threatTypes_.hashCode(); + } + if (hasExpireTime()) { + hash = (37 * hash) + EXPIRE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getExpireTime().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.webrisk.v1.SearchUrisResponse.ThreatUri parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.SearchUrisResponse.ThreatUri 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.SearchUrisResponse.ThreatUri parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.SearchUrisResponse.ThreatUri 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.SearchUrisResponse.ThreatUri parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.SearchUrisResponse.ThreatUri parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.SearchUrisResponse.ThreatUri parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.SearchUrisResponse.ThreatUri 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.SearchUrisResponse.ThreatUri parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.SearchUrisResponse.ThreatUri 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.SearchUrisResponse.ThreatUri parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.SearchUrisResponse.ThreatUri 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.SearchUrisResponse.ThreatUri 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; + } + /** + * + * + *
+     * Contains threat information on a matching uri.
+     * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri) + com.google.webrisk.v1.SearchUrisResponse.ThreatUriOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SearchUrisResponse_ThreatUri_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SearchUrisResponse_ThreatUri_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.SearchUrisResponse.ThreatUri.class, + com.google.webrisk.v1.SearchUrisResponse.ThreatUri.Builder.class); + } + + // Construct using com.google.webrisk.v1.SearchUrisResponse.ThreatUri.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + threatTypes_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + if (expireTimeBuilder_ == null) { + expireTime_ = null; + } else { + expireTime_ = null; + expireTimeBuilder_ = 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_SearchUrisResponse_ThreatUri_descriptor; + } + + @java.lang.Override + public com.google.webrisk.v1.SearchUrisResponse.ThreatUri getDefaultInstanceForType() { + return com.google.webrisk.v1.SearchUrisResponse.ThreatUri.getDefaultInstance(); + } + + @java.lang.Override + public com.google.webrisk.v1.SearchUrisResponse.ThreatUri build() { + com.google.webrisk.v1.SearchUrisResponse.ThreatUri result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.webrisk.v1.SearchUrisResponse.ThreatUri buildPartial() { + com.google.webrisk.v1.SearchUrisResponse.ThreatUri result = + new com.google.webrisk.v1.SearchUrisResponse.ThreatUri(this); + int from_bitField0_ = bitField0_; + if (((bitField0_ & 0x00000001) != 0)) { + threatTypes_ = java.util.Collections.unmodifiableList(threatTypes_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.threatTypes_ = threatTypes_; + if (expireTimeBuilder_ == null) { + result.expireTime_ = expireTime_; + } else { + result.expireTime_ = expireTimeBuilder_.build(); + } + onBuilt(); + return result; + } + + @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.SearchUrisResponse.ThreatUri) { + return mergeFrom((com.google.webrisk.v1.SearchUrisResponse.ThreatUri) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.webrisk.v1.SearchUrisResponse.ThreatUri other) { + if (other == com.google.webrisk.v1.SearchUrisResponse.ThreatUri.getDefaultInstance()) + return this; + if (!other.threatTypes_.isEmpty()) { + if (threatTypes_.isEmpty()) { + threatTypes_ = other.threatTypes_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureThreatTypesIsMutable(); + threatTypes_.addAll(other.threatTypes_); + } + onChanged(); + } + if (other.hasExpireTime()) { + mergeExpireTime(other.getExpireTime()); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.webrisk.v1.SearchUrisResponse.ThreatUri parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.webrisk.v1.SearchUrisResponse.ThreatUri) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List threatTypes_ = java.util.Collections.emptyList(); + + private void ensureThreatTypesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + threatTypes_ = new java.util.ArrayList(threatTypes_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+       * The ThreatList this threat belongs to.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @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_); + } + /** + * + * + *
+       * The ThreatList this threat belongs to.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @return The count of threatTypes. + */ + public int getThreatTypesCount() { + return threatTypes_.size(); + } + /** + * + * + *
+       * The ThreatList this threat belongs to.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @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)); + } + /** + * + * + *
+       * The ThreatList this threat belongs to.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @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; + } + /** + * + * + *
+       * The ThreatList this threat belongs to.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @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; + } + /** + * + * + *
+       * The ThreatList this threat belongs to.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @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; + } + /** + * + * + *
+       * The ThreatList this threat belongs to.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @return This builder for chaining. + */ + public Builder clearThreatTypes() { + threatTypes_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+       * The ThreatList this threat belongs to.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @return A list containing the enum numeric values on the wire for threatTypes. + */ + public java.util.List getThreatTypesValueList() { + return java.util.Collections.unmodifiableList(threatTypes_); + } + /** + * + * + *
+       * The ThreatList this threat belongs to.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @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); + } + /** + * + * + *
+       * The ThreatList this threat belongs to.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of threatTypes at the given index. + * @return This builder for chaining. + */ + public Builder setThreatTypesValue(int index, int value) { + ensureThreatTypesIsMutable(); + threatTypes_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+       * The ThreatList this threat belongs to.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @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; + } + /** + * + * + *
+       * The ThreatList this threat belongs to.
+       * 
+ * + * repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * + * @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; + } + + private com.google.protobuf.Timestamp expireTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + expireTimeBuilder_; + /** + * + * + *
+       * The cache lifetime for the returned match. Clients must not cache this
+       * response past this timestamp to avoid false positives.
+       * 
+ * + * .google.protobuf.Timestamp expire_time = 2; + * + * @return Whether the expireTime field is set. + */ + public boolean hasExpireTime() { + return expireTimeBuilder_ != null || expireTime_ != null; + } + /** + * + * + *
+       * The cache lifetime for the returned match. Clients must not cache this
+       * response past this timestamp to avoid false positives.
+       * 
+ * + * .google.protobuf.Timestamp expire_time = 2; + * + * @return The expireTime. + */ + public com.google.protobuf.Timestamp getExpireTime() { + if (expireTimeBuilder_ == null) { + return expireTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : expireTime_; + } else { + return expireTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+       * The cache lifetime for the returned match. Clients must not cache this
+       * response past this timestamp to avoid false positives.
+       * 
+ * + * .google.protobuf.Timestamp expire_time = 2; + */ + public Builder setExpireTime(com.google.protobuf.Timestamp value) { + if (expireTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + expireTime_ = value; + onChanged(); + } else { + expireTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+       * The cache lifetime for the returned match. Clients must not cache this
+       * response past this timestamp to avoid false positives.
+       * 
+ * + * .google.protobuf.Timestamp expire_time = 2; + */ + public Builder setExpireTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (expireTimeBuilder_ == null) { + expireTime_ = builderForValue.build(); + onChanged(); + } else { + expireTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+       * The cache lifetime for the returned match. Clients must not cache this
+       * response past this timestamp to avoid false positives.
+       * 
+ * + * .google.protobuf.Timestamp expire_time = 2; + */ + public Builder mergeExpireTime(com.google.protobuf.Timestamp value) { + if (expireTimeBuilder_ == null) { + if (expireTime_ != null) { + expireTime_ = + com.google.protobuf.Timestamp.newBuilder(expireTime_) + .mergeFrom(value) + .buildPartial(); + } else { + expireTime_ = value; + } + onChanged(); + } else { + expireTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+       * The cache lifetime for the returned match. Clients must not cache this
+       * response past this timestamp to avoid false positives.
+       * 
+ * + * .google.protobuf.Timestamp expire_time = 2; + */ + public Builder clearExpireTime() { + if (expireTimeBuilder_ == null) { + expireTime_ = null; + onChanged(); + } else { + expireTime_ = null; + expireTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+       * The cache lifetime for the returned match. Clients must not cache this
+       * response past this timestamp to avoid false positives.
+       * 
+ * + * .google.protobuf.Timestamp expire_time = 2; + */ + public com.google.protobuf.Timestamp.Builder getExpireTimeBuilder() { + + onChanged(); + return getExpireTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+       * The cache lifetime for the returned match. Clients must not cache this
+       * response past this timestamp to avoid false positives.
+       * 
+ * + * .google.protobuf.Timestamp expire_time = 2; + */ + public com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder() { + if (expireTimeBuilder_ != null) { + return expireTimeBuilder_.getMessageOrBuilder(); + } else { + return expireTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : expireTime_; + } + } + /** + * + * + *
+       * The cache lifetime for the returned match. Clients must not cache this
+       * response past this timestamp to avoid false positives.
+       * 
+ * + * .google.protobuf.Timestamp expire_time = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getExpireTimeFieldBuilder() { + if (expireTimeBuilder_ == null) { + expireTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getExpireTime(), getParentForChildren(), isClean()); + expireTime_ = null; + } + return expireTimeBuilder_; + } + + @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.SearchUrisResponse.ThreatUri) + } + + // @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri) + private static final com.google.webrisk.v1.SearchUrisResponse.ThreatUri DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.webrisk.v1.SearchUrisResponse.ThreatUri(); + } + + public static com.google.webrisk.v1.SearchUrisResponse.ThreatUri getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ThreatUri parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ThreatUri(input, extensionRegistry); + } + }; + + 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.SearchUrisResponse.ThreatUri getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public static final int THREAT_FIELD_NUMBER = 1; + private com.google.webrisk.v1.SearchUrisResponse.ThreatUri threat_; + /** + * + * + *
+   * The threat list matches. This may be empty if the URI is on no list.
+   * 
+ * + * .google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri threat = 1; + * + * @return Whether the threat field is set. + */ + public boolean hasThreat() { + return threat_ != null; + } + /** + * + * + *
+   * The threat list matches. This may be empty if the URI is on no list.
+   * 
+ * + * .google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri threat = 1; + * + * @return The threat. + */ + public com.google.webrisk.v1.SearchUrisResponse.ThreatUri getThreat() { + return threat_ == null + ? com.google.webrisk.v1.SearchUrisResponse.ThreatUri.getDefaultInstance() + : threat_; + } + /** + * + * + *
+   * The threat list matches. This may be empty if the URI is on no list.
+   * 
+ * + * .google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri threat = 1; + */ + public com.google.webrisk.v1.SearchUrisResponse.ThreatUriOrBuilder getThreatOrBuilder() { + return getThreat(); + } + + 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 (threat_ != null) { + output.writeMessage(1, getThreat()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (threat_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getThreat()); + } + size += unknownFields.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.SearchUrisResponse)) { + return super.equals(obj); + } + com.google.webrisk.v1.SearchUrisResponse other = (com.google.webrisk.v1.SearchUrisResponse) obj; + + if (hasThreat() != other.hasThreat()) return false; + if (hasThreat()) { + if (!getThreat().equals(other.getThreat())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasThreat()) { + hash = (37 * hash) + THREAT_FIELD_NUMBER; + hash = (53 * hash) + getThreat().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.webrisk.v1.SearchUrisResponse parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.SearchUrisResponse 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.SearchUrisResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.SearchUrisResponse 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.SearchUrisResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.SearchUrisResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.SearchUrisResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.SearchUrisResponse 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.SearchUrisResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.SearchUrisResponse 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.SearchUrisResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.SearchUrisResponse 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.SearchUrisResponse 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; + } + /** Protobuf type {@code google.cloud.webrisk.v1.SearchUrisResponse} */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.webrisk.v1.SearchUrisResponse) + com.google.webrisk.v1.SearchUrisResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SearchUrisResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_SearchUrisResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.SearchUrisResponse.class, + com.google.webrisk.v1.SearchUrisResponse.Builder.class); + } + + // Construct using com.google.webrisk.v1.SearchUrisResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (threatBuilder_ == null) { + threat_ = null; + } else { + threat_ = null; + threatBuilder_ = 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_SearchUrisResponse_descriptor; + } + + @java.lang.Override + public com.google.webrisk.v1.SearchUrisResponse getDefaultInstanceForType() { + return com.google.webrisk.v1.SearchUrisResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.webrisk.v1.SearchUrisResponse build() { + com.google.webrisk.v1.SearchUrisResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.webrisk.v1.SearchUrisResponse buildPartial() { + com.google.webrisk.v1.SearchUrisResponse result = + new com.google.webrisk.v1.SearchUrisResponse(this); + if (threatBuilder_ == null) { + result.threat_ = threat_; + } else { + result.threat_ = threatBuilder_.build(); + } + onBuilt(); + return result; + } + + @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.SearchUrisResponse) { + return mergeFrom((com.google.webrisk.v1.SearchUrisResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.webrisk.v1.SearchUrisResponse other) { + if (other == com.google.webrisk.v1.SearchUrisResponse.getDefaultInstance()) return this; + if (other.hasThreat()) { + mergeThreat(other.getThreat()); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.webrisk.v1.SearchUrisResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.webrisk.v1.SearchUrisResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.webrisk.v1.SearchUrisResponse.ThreatUri threat_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.SearchUrisResponse.ThreatUri, + com.google.webrisk.v1.SearchUrisResponse.ThreatUri.Builder, + com.google.webrisk.v1.SearchUrisResponse.ThreatUriOrBuilder> + threatBuilder_; + /** + * + * + *
+     * The threat list matches. This may be empty if the URI is on no list.
+     * 
+ * + * .google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri threat = 1; + * + * @return Whether the threat field is set. + */ + public boolean hasThreat() { + return threatBuilder_ != null || threat_ != null; + } + /** + * + * + *
+     * The threat list matches. This may be empty if the URI is on no list.
+     * 
+ * + * .google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri threat = 1; + * + * @return The threat. + */ + public com.google.webrisk.v1.SearchUrisResponse.ThreatUri getThreat() { + if (threatBuilder_ == null) { + return threat_ == null + ? com.google.webrisk.v1.SearchUrisResponse.ThreatUri.getDefaultInstance() + : threat_; + } else { + return threatBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The threat list matches. This may be empty if the URI is on no list.
+     * 
+ * + * .google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri threat = 1; + */ + public Builder setThreat(com.google.webrisk.v1.SearchUrisResponse.ThreatUri value) { + if (threatBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + threat_ = value; + onChanged(); + } else { + threatBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The threat list matches. This may be empty if the URI is on no list.
+     * 
+ * + * .google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri threat = 1; + */ + public Builder setThreat( + com.google.webrisk.v1.SearchUrisResponse.ThreatUri.Builder builderForValue) { + if (threatBuilder_ == null) { + threat_ = builderForValue.build(); + onChanged(); + } else { + threatBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The threat list matches. This may be empty if the URI is on no list.
+     * 
+ * + * .google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri threat = 1; + */ + public Builder mergeThreat(com.google.webrisk.v1.SearchUrisResponse.ThreatUri value) { + if (threatBuilder_ == null) { + if (threat_ != null) { + threat_ = + com.google.webrisk.v1.SearchUrisResponse.ThreatUri.newBuilder(threat_) + .mergeFrom(value) + .buildPartial(); + } else { + threat_ = value; + } + onChanged(); + } else { + threatBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The threat list matches. This may be empty if the URI is on no list.
+     * 
+ * + * .google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri threat = 1; + */ + public Builder clearThreat() { + if (threatBuilder_ == null) { + threat_ = null; + onChanged(); + } else { + threat_ = null; + threatBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The threat list matches. This may be empty if the URI is on no list.
+     * 
+ * + * .google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri threat = 1; + */ + public com.google.webrisk.v1.SearchUrisResponse.ThreatUri.Builder getThreatBuilder() { + + onChanged(); + return getThreatFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The threat list matches. This may be empty if the URI is on no list.
+     * 
+ * + * .google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri threat = 1; + */ + public com.google.webrisk.v1.SearchUrisResponse.ThreatUriOrBuilder getThreatOrBuilder() { + if (threatBuilder_ != null) { + return threatBuilder_.getMessageOrBuilder(); + } else { + return threat_ == null + ? com.google.webrisk.v1.SearchUrisResponse.ThreatUri.getDefaultInstance() + : threat_; + } + } + /** + * + * + *
+     * The threat list matches. This may be empty if the URI is on no list.
+     * 
+ * + * .google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri threat = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.SearchUrisResponse.ThreatUri, + com.google.webrisk.v1.SearchUrisResponse.ThreatUri.Builder, + com.google.webrisk.v1.SearchUrisResponse.ThreatUriOrBuilder> + getThreatFieldBuilder() { + if (threatBuilder_ == null) { + threatBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.SearchUrisResponse.ThreatUri, + com.google.webrisk.v1.SearchUrisResponse.ThreatUri.Builder, + com.google.webrisk.v1.SearchUrisResponse.ThreatUriOrBuilder>( + getThreat(), getParentForChildren(), isClean()); + threat_ = null; + } + return threatBuilder_; + } + + @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.SearchUrisResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.SearchUrisResponse) + private static final com.google.webrisk.v1.SearchUrisResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.webrisk.v1.SearchUrisResponse(); + } + + public static com.google.webrisk.v1.SearchUrisResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SearchUrisResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new SearchUrisResponse(input, extensionRegistry); + } + }; + + 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.SearchUrisResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchUrisResponseOrBuilder.java b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchUrisResponseOrBuilder.java new file mode 100644 index 00000000..795fbaaf --- /dev/null +++ b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SearchUrisResponseOrBuilder.java @@ -0,0 +1,60 @@ +/* + * 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 SearchUrisResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.webrisk.v1.SearchUrisResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The threat list matches. This may be empty if the URI is on no list.
+   * 
+ * + * .google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri threat = 1; + * + * @return Whether the threat field is set. + */ + boolean hasThreat(); + /** + * + * + *
+   * The threat list matches. This may be empty if the URI is on no list.
+   * 
+ * + * .google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri threat = 1; + * + * @return The threat. + */ + com.google.webrisk.v1.SearchUrisResponse.ThreatUri getThreat(); + /** + * + * + *
+   * The threat list matches. This may be empty if the URI is on no list.
+   * 
+ * + * .google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri threat = 1; + */ + com.google.webrisk.v1.SearchUrisResponse.ThreatUriOrBuilder getThreatOrBuilder(); +} diff --git a/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/Submission.java b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/Submission.java new file mode 100644 index 00000000..66c65cd5 --- /dev/null +++ b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/Submission.java @@ -0,0 +1,628 @@ +/* + * 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; + +/** + * + * + *
+ * Wraps a URI that might be displaying phishing content.
+ * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.Submission} + */ +public final class Submission extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.webrisk.v1.Submission) + SubmissionOrBuilder { + private static final long serialVersionUID = 0L; + // Use Submission.newBuilder() to construct. + private Submission(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Submission() { + uri_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Submission(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Submission( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + uri_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_Submission_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_Submission_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.Submission.class, com.google.webrisk.v1.Submission.Builder.class); + } + + public static final int URI_FIELD_NUMBER = 1; + private volatile java.lang.Object uri_; + /** + * + * + *
+   * Required. The URI that is being reported for phishing content to be analyzed.
+   * 
+ * + * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The uri. + */ + public java.lang.String getUri() { + java.lang.Object ref = uri_; + 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(); + uri_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The URI that is being reported for phishing content to be analyzed.
+   * 
+ * + * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for uri. + */ + public com.google.protobuf.ByteString getUriBytes() { + java.lang.Object ref = uri_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + 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 (!getUriBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, uri_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getUriBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, uri_); + } + size += unknownFields.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.Submission)) { + return super.equals(obj); + } + com.google.webrisk.v1.Submission other = (com.google.webrisk.v1.Submission) obj; + + if (!getUri().equals(other.getUri())) return false; + if (!unknownFields.equals(other.unknownFields)) 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) + URI_FIELD_NUMBER; + hash = (53 * hash) + getUri().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.webrisk.v1.Submission parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.Submission 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.Submission parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.Submission 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.Submission parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.Submission parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.Submission parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.Submission 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.Submission parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.Submission 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.Submission parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.Submission 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.Submission 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; + } + /** + * + * + *
+   * Wraps a URI that might be displaying phishing content.
+   * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.Submission} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.webrisk.v1.Submission) + com.google.webrisk.v1.SubmissionOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_Submission_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_Submission_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.Submission.class, + com.google.webrisk.v1.Submission.Builder.class); + } + + // Construct using com.google.webrisk.v1.Submission.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + uri_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_Submission_descriptor; + } + + @java.lang.Override + public com.google.webrisk.v1.Submission getDefaultInstanceForType() { + return com.google.webrisk.v1.Submission.getDefaultInstance(); + } + + @java.lang.Override + public com.google.webrisk.v1.Submission build() { + com.google.webrisk.v1.Submission result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.webrisk.v1.Submission buildPartial() { + com.google.webrisk.v1.Submission result = new com.google.webrisk.v1.Submission(this); + result.uri_ = uri_; + onBuilt(); + return result; + } + + @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.Submission) { + return mergeFrom((com.google.webrisk.v1.Submission) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.webrisk.v1.Submission other) { + if (other == com.google.webrisk.v1.Submission.getDefaultInstance()) return this; + if (!other.getUri().isEmpty()) { + uri_ = other.uri_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.webrisk.v1.Submission parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.webrisk.v1.Submission) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object uri_ = ""; + /** + * + * + *
+     * Required. The URI that is being reported for phishing content to be analyzed.
+     * 
+ * + * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The uri. + */ + public java.lang.String getUri() { + java.lang.Object ref = uri_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uri_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The URI that is being reported for phishing content to be analyzed.
+     * 
+ * + * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for uri. + */ + public com.google.protobuf.ByteString getUriBytes() { + java.lang.Object ref = uri_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The URI that is being reported for phishing content to be analyzed.
+     * 
+ * + * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The uri to set. + * @return This builder for chaining. + */ + public Builder setUri(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + uri_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The URI that is being reported for phishing content to be analyzed.
+     * 
+ * + * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearUri() { + + uri_ = getDefaultInstance().getUri(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The URI that is being reported for phishing content to be analyzed.
+     * 
+ * + * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for uri to set. + * @return This builder for chaining. + */ + public Builder setUriBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + uri_ = 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.Submission) + } + + // @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.Submission) + private static final com.google.webrisk.v1.Submission DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.webrisk.v1.Submission(); + } + + public static com.google.webrisk.v1.Submission getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Submission parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Submission(input, extensionRegistry); + } + }; + + 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.Submission getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SubmissionOrBuilder.java b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SubmissionOrBuilder.java new file mode 100644 index 00000000..2ccf8fb2 --- /dev/null +++ b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/SubmissionOrBuilder.java @@ -0,0 +1,50 @@ +/* + * 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 SubmissionOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.webrisk.v1.Submission) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The URI that is being reported for phishing content to be analyzed.
+   * 
+ * + * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The uri. + */ + java.lang.String getUri(); + /** + * + * + *
+   * Required. The URI that is being reported for phishing content to be analyzed.
+   * 
+ * + * string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for uri. + */ + com.google.protobuf.ByteString getUriBytes(); +} diff --git a/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatEntryAdditions.java b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatEntryAdditions.java new file mode 100644 index 00000000..8f7229d0 --- /dev/null +++ b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatEntryAdditions.java @@ -0,0 +1,1263 @@ +/* + * 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; + +/** + * + * + *
+ * Contains the set of entries to add to a local database.
+ * May contain a combination of compressed and raw data in a single response.
+ * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.ThreatEntryAdditions} + */ +public final class ThreatEntryAdditions extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.webrisk.v1.ThreatEntryAdditions) + ThreatEntryAdditionsOrBuilder { + private static final long serialVersionUID = 0L; + // Use ThreatEntryAdditions.newBuilder() to construct. + private ThreatEntryAdditions(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ThreatEntryAdditions() { + rawHashes_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ThreatEntryAdditions(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ThreatEntryAdditions( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + rawHashes_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + rawHashes_.add( + input.readMessage(com.google.webrisk.v1.RawHashes.parser(), extensionRegistry)); + break; + } + case 18: + { + com.google.webrisk.v1.RiceDeltaEncoding.Builder subBuilder = null; + if (riceHashes_ != null) { + subBuilder = riceHashes_.toBuilder(); + } + riceHashes_ = + input.readMessage( + com.google.webrisk.v1.RiceDeltaEncoding.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(riceHashes_); + riceHashes_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + rawHashes_ = java.util.Collections.unmodifiableList(rawHashes_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ThreatEntryAdditions_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ThreatEntryAdditions_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.ThreatEntryAdditions.class, + com.google.webrisk.v1.ThreatEntryAdditions.Builder.class); + } + + public static final int RAW_HASHES_FIELD_NUMBER = 1; + private java.util.List rawHashes_; + /** + * + * + *
+   * The raw SHA256-formatted entries.
+   * Repeated to allow returning sets of hashes with different prefix sizes.
+   * 
+ * + * repeated .google.cloud.webrisk.v1.RawHashes raw_hashes = 1; + */ + public java.util.List getRawHashesList() { + return rawHashes_; + } + /** + * + * + *
+   * The raw SHA256-formatted entries.
+   * Repeated to allow returning sets of hashes with different prefix sizes.
+   * 
+ * + * repeated .google.cloud.webrisk.v1.RawHashes raw_hashes = 1; + */ + public java.util.List + getRawHashesOrBuilderList() { + return rawHashes_; + } + /** + * + * + *
+   * The raw SHA256-formatted entries.
+   * Repeated to allow returning sets of hashes with different prefix sizes.
+   * 
+ * + * repeated .google.cloud.webrisk.v1.RawHashes raw_hashes = 1; + */ + public int getRawHashesCount() { + return rawHashes_.size(); + } + /** + * + * + *
+   * The raw SHA256-formatted entries.
+   * Repeated to allow returning sets of hashes with different prefix sizes.
+   * 
+ * + * repeated .google.cloud.webrisk.v1.RawHashes raw_hashes = 1; + */ + public com.google.webrisk.v1.RawHashes getRawHashes(int index) { + return rawHashes_.get(index); + } + /** + * + * + *
+   * The raw SHA256-formatted entries.
+   * Repeated to allow returning sets of hashes with different prefix sizes.
+   * 
+ * + * repeated .google.cloud.webrisk.v1.RawHashes raw_hashes = 1; + */ + public com.google.webrisk.v1.RawHashesOrBuilder getRawHashesOrBuilder(int index) { + return rawHashes_.get(index); + } + + public static final int RICE_HASHES_FIELD_NUMBER = 2; + private com.google.webrisk.v1.RiceDeltaEncoding riceHashes_; + /** + * + * + *
+   * The encoded 4-byte prefixes of SHA256-formatted entries, using a
+   * Golomb-Rice encoding. The hashes are converted to uint32, sorted in
+   * ascending order, then delta encoded and stored as encoded_data.
+   * 
+ * + * .google.cloud.webrisk.v1.RiceDeltaEncoding rice_hashes = 2; + * + * @return Whether the riceHashes field is set. + */ + public boolean hasRiceHashes() { + return riceHashes_ != null; + } + /** + * + * + *
+   * The encoded 4-byte prefixes of SHA256-formatted entries, using a
+   * Golomb-Rice encoding. The hashes are converted to uint32, sorted in
+   * ascending order, then delta encoded and stored as encoded_data.
+   * 
+ * + * .google.cloud.webrisk.v1.RiceDeltaEncoding rice_hashes = 2; + * + * @return The riceHashes. + */ + public com.google.webrisk.v1.RiceDeltaEncoding getRiceHashes() { + return riceHashes_ == null + ? com.google.webrisk.v1.RiceDeltaEncoding.getDefaultInstance() + : riceHashes_; + } + /** + * + * + *
+   * The encoded 4-byte prefixes of SHA256-formatted entries, using a
+   * Golomb-Rice encoding. The hashes are converted to uint32, sorted in
+   * ascending order, then delta encoded and stored as encoded_data.
+   * 
+ * + * .google.cloud.webrisk.v1.RiceDeltaEncoding rice_hashes = 2; + */ + public com.google.webrisk.v1.RiceDeltaEncodingOrBuilder getRiceHashesOrBuilder() { + return getRiceHashes(); + } + + 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 { + for (int i = 0; i < rawHashes_.size(); i++) { + output.writeMessage(1, rawHashes_.get(i)); + } + if (riceHashes_ != null) { + output.writeMessage(2, getRiceHashes()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < rawHashes_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, rawHashes_.get(i)); + } + if (riceHashes_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getRiceHashes()); + } + size += unknownFields.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.ThreatEntryAdditions)) { + return super.equals(obj); + } + com.google.webrisk.v1.ThreatEntryAdditions other = + (com.google.webrisk.v1.ThreatEntryAdditions) obj; + + if (!getRawHashesList().equals(other.getRawHashesList())) return false; + if (hasRiceHashes() != other.hasRiceHashes()) return false; + if (hasRiceHashes()) { + if (!getRiceHashes().equals(other.getRiceHashes())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getRawHashesCount() > 0) { + hash = (37 * hash) + RAW_HASHES_FIELD_NUMBER; + hash = (53 * hash) + getRawHashesList().hashCode(); + } + if (hasRiceHashes()) { + hash = (37 * hash) + RICE_HASHES_FIELD_NUMBER; + hash = (53 * hash) + getRiceHashes().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.webrisk.v1.ThreatEntryAdditions parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.ThreatEntryAdditions 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.ThreatEntryAdditions parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.ThreatEntryAdditions 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.ThreatEntryAdditions parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.ThreatEntryAdditions parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.ThreatEntryAdditions parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.ThreatEntryAdditions 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.ThreatEntryAdditions parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.ThreatEntryAdditions 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.ThreatEntryAdditions parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.ThreatEntryAdditions 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.ThreatEntryAdditions 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; + } + /** + * + * + *
+   * Contains the set of entries to add to a local database.
+   * May contain a combination of compressed and raw data in a single response.
+   * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.ThreatEntryAdditions} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.webrisk.v1.ThreatEntryAdditions) + com.google.webrisk.v1.ThreatEntryAdditionsOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ThreatEntryAdditions_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ThreatEntryAdditions_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.ThreatEntryAdditions.class, + com.google.webrisk.v1.ThreatEntryAdditions.Builder.class); + } + + // Construct using com.google.webrisk.v1.ThreatEntryAdditions.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getRawHashesFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (rawHashesBuilder_ == null) { + rawHashes_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + rawHashesBuilder_.clear(); + } + if (riceHashesBuilder_ == null) { + riceHashes_ = null; + } else { + riceHashes_ = null; + riceHashesBuilder_ = 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_ThreatEntryAdditions_descriptor; + } + + @java.lang.Override + public com.google.webrisk.v1.ThreatEntryAdditions getDefaultInstanceForType() { + return com.google.webrisk.v1.ThreatEntryAdditions.getDefaultInstance(); + } + + @java.lang.Override + public com.google.webrisk.v1.ThreatEntryAdditions build() { + com.google.webrisk.v1.ThreatEntryAdditions result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.webrisk.v1.ThreatEntryAdditions buildPartial() { + com.google.webrisk.v1.ThreatEntryAdditions result = + new com.google.webrisk.v1.ThreatEntryAdditions(this); + int from_bitField0_ = bitField0_; + if (rawHashesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + rawHashes_ = java.util.Collections.unmodifiableList(rawHashes_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.rawHashes_ = rawHashes_; + } else { + result.rawHashes_ = rawHashesBuilder_.build(); + } + if (riceHashesBuilder_ == null) { + result.riceHashes_ = riceHashes_; + } else { + result.riceHashes_ = riceHashesBuilder_.build(); + } + onBuilt(); + return result; + } + + @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.ThreatEntryAdditions) { + return mergeFrom((com.google.webrisk.v1.ThreatEntryAdditions) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.webrisk.v1.ThreatEntryAdditions other) { + if (other == com.google.webrisk.v1.ThreatEntryAdditions.getDefaultInstance()) return this; + if (rawHashesBuilder_ == null) { + if (!other.rawHashes_.isEmpty()) { + if (rawHashes_.isEmpty()) { + rawHashes_ = other.rawHashes_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureRawHashesIsMutable(); + rawHashes_.addAll(other.rawHashes_); + } + onChanged(); + } + } else { + if (!other.rawHashes_.isEmpty()) { + if (rawHashesBuilder_.isEmpty()) { + rawHashesBuilder_.dispose(); + rawHashesBuilder_ = null; + rawHashes_ = other.rawHashes_; + bitField0_ = (bitField0_ & ~0x00000001); + rawHashesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getRawHashesFieldBuilder() + : null; + } else { + rawHashesBuilder_.addAllMessages(other.rawHashes_); + } + } + } + if (other.hasRiceHashes()) { + mergeRiceHashes(other.getRiceHashes()); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.webrisk.v1.ThreatEntryAdditions parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.webrisk.v1.ThreatEntryAdditions) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List rawHashes_ = + java.util.Collections.emptyList(); + + private void ensureRawHashesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + rawHashes_ = new java.util.ArrayList(rawHashes_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.webrisk.v1.RawHashes, + com.google.webrisk.v1.RawHashes.Builder, + com.google.webrisk.v1.RawHashesOrBuilder> + rawHashesBuilder_; + + /** + * + * + *
+     * The raw SHA256-formatted entries.
+     * Repeated to allow returning sets of hashes with different prefix sizes.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.RawHashes raw_hashes = 1; + */ + public java.util.List getRawHashesList() { + if (rawHashesBuilder_ == null) { + return java.util.Collections.unmodifiableList(rawHashes_); + } else { + return rawHashesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * The raw SHA256-formatted entries.
+     * Repeated to allow returning sets of hashes with different prefix sizes.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.RawHashes raw_hashes = 1; + */ + public int getRawHashesCount() { + if (rawHashesBuilder_ == null) { + return rawHashes_.size(); + } else { + return rawHashesBuilder_.getCount(); + } + } + /** + * + * + *
+     * The raw SHA256-formatted entries.
+     * Repeated to allow returning sets of hashes with different prefix sizes.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.RawHashes raw_hashes = 1; + */ + public com.google.webrisk.v1.RawHashes getRawHashes(int index) { + if (rawHashesBuilder_ == null) { + return rawHashes_.get(index); + } else { + return rawHashesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * The raw SHA256-formatted entries.
+     * Repeated to allow returning sets of hashes with different prefix sizes.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.RawHashes raw_hashes = 1; + */ + public Builder setRawHashes(int index, com.google.webrisk.v1.RawHashes value) { + if (rawHashesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureRawHashesIsMutable(); + rawHashes_.set(index, value); + onChanged(); + } else { + rawHashesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The raw SHA256-formatted entries.
+     * Repeated to allow returning sets of hashes with different prefix sizes.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.RawHashes raw_hashes = 1; + */ + public Builder setRawHashes( + int index, com.google.webrisk.v1.RawHashes.Builder builderForValue) { + if (rawHashesBuilder_ == null) { + ensureRawHashesIsMutable(); + rawHashes_.set(index, builderForValue.build()); + onChanged(); + } else { + rawHashesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The raw SHA256-formatted entries.
+     * Repeated to allow returning sets of hashes with different prefix sizes.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.RawHashes raw_hashes = 1; + */ + public Builder addRawHashes(com.google.webrisk.v1.RawHashes value) { + if (rawHashesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureRawHashesIsMutable(); + rawHashes_.add(value); + onChanged(); + } else { + rawHashesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * The raw SHA256-formatted entries.
+     * Repeated to allow returning sets of hashes with different prefix sizes.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.RawHashes raw_hashes = 1; + */ + public Builder addRawHashes(int index, com.google.webrisk.v1.RawHashes value) { + if (rawHashesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureRawHashesIsMutable(); + rawHashes_.add(index, value); + onChanged(); + } else { + rawHashesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The raw SHA256-formatted entries.
+     * Repeated to allow returning sets of hashes with different prefix sizes.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.RawHashes raw_hashes = 1; + */ + public Builder addRawHashes(com.google.webrisk.v1.RawHashes.Builder builderForValue) { + if (rawHashesBuilder_ == null) { + ensureRawHashesIsMutable(); + rawHashes_.add(builderForValue.build()); + onChanged(); + } else { + rawHashesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The raw SHA256-formatted entries.
+     * Repeated to allow returning sets of hashes with different prefix sizes.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.RawHashes raw_hashes = 1; + */ + public Builder addRawHashes( + int index, com.google.webrisk.v1.RawHashes.Builder builderForValue) { + if (rawHashesBuilder_ == null) { + ensureRawHashesIsMutable(); + rawHashes_.add(index, builderForValue.build()); + onChanged(); + } else { + rawHashesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The raw SHA256-formatted entries.
+     * Repeated to allow returning sets of hashes with different prefix sizes.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.RawHashes raw_hashes = 1; + */ + public Builder addAllRawHashes( + java.lang.Iterable values) { + if (rawHashesBuilder_ == null) { + ensureRawHashesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, rawHashes_); + onChanged(); + } else { + rawHashesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * The raw SHA256-formatted entries.
+     * Repeated to allow returning sets of hashes with different prefix sizes.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.RawHashes raw_hashes = 1; + */ + public Builder clearRawHashes() { + if (rawHashesBuilder_ == null) { + rawHashes_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + rawHashesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The raw SHA256-formatted entries.
+     * Repeated to allow returning sets of hashes with different prefix sizes.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.RawHashes raw_hashes = 1; + */ + public Builder removeRawHashes(int index) { + if (rawHashesBuilder_ == null) { + ensureRawHashesIsMutable(); + rawHashes_.remove(index); + onChanged(); + } else { + rawHashesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * The raw SHA256-formatted entries.
+     * Repeated to allow returning sets of hashes with different prefix sizes.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.RawHashes raw_hashes = 1; + */ + public com.google.webrisk.v1.RawHashes.Builder getRawHashesBuilder(int index) { + return getRawHashesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * The raw SHA256-formatted entries.
+     * Repeated to allow returning sets of hashes with different prefix sizes.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.RawHashes raw_hashes = 1; + */ + public com.google.webrisk.v1.RawHashesOrBuilder getRawHashesOrBuilder(int index) { + if (rawHashesBuilder_ == null) { + return rawHashes_.get(index); + } else { + return rawHashesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * The raw SHA256-formatted entries.
+     * Repeated to allow returning sets of hashes with different prefix sizes.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.RawHashes raw_hashes = 1; + */ + public java.util.List + getRawHashesOrBuilderList() { + if (rawHashesBuilder_ != null) { + return rawHashesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(rawHashes_); + } + } + /** + * + * + *
+     * The raw SHA256-formatted entries.
+     * Repeated to allow returning sets of hashes with different prefix sizes.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.RawHashes raw_hashes = 1; + */ + public com.google.webrisk.v1.RawHashes.Builder addRawHashesBuilder() { + return getRawHashesFieldBuilder() + .addBuilder(com.google.webrisk.v1.RawHashes.getDefaultInstance()); + } + /** + * + * + *
+     * The raw SHA256-formatted entries.
+     * Repeated to allow returning sets of hashes with different prefix sizes.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.RawHashes raw_hashes = 1; + */ + public com.google.webrisk.v1.RawHashes.Builder addRawHashesBuilder(int index) { + return getRawHashesFieldBuilder() + .addBuilder(index, com.google.webrisk.v1.RawHashes.getDefaultInstance()); + } + /** + * + * + *
+     * The raw SHA256-formatted entries.
+     * Repeated to allow returning sets of hashes with different prefix sizes.
+     * 
+ * + * repeated .google.cloud.webrisk.v1.RawHashes raw_hashes = 1; + */ + public java.util.List getRawHashesBuilderList() { + return getRawHashesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.webrisk.v1.RawHashes, + com.google.webrisk.v1.RawHashes.Builder, + com.google.webrisk.v1.RawHashesOrBuilder> + getRawHashesFieldBuilder() { + if (rawHashesBuilder_ == null) { + rawHashesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.webrisk.v1.RawHashes, + com.google.webrisk.v1.RawHashes.Builder, + com.google.webrisk.v1.RawHashesOrBuilder>( + rawHashes_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + rawHashes_ = null; + } + return rawHashesBuilder_; + } + + private com.google.webrisk.v1.RiceDeltaEncoding riceHashes_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.RiceDeltaEncoding, + com.google.webrisk.v1.RiceDeltaEncoding.Builder, + com.google.webrisk.v1.RiceDeltaEncodingOrBuilder> + riceHashesBuilder_; + /** + * + * + *
+     * The encoded 4-byte prefixes of SHA256-formatted entries, using a
+     * Golomb-Rice encoding. The hashes are converted to uint32, sorted in
+     * ascending order, then delta encoded and stored as encoded_data.
+     * 
+ * + * .google.cloud.webrisk.v1.RiceDeltaEncoding rice_hashes = 2; + * + * @return Whether the riceHashes field is set. + */ + public boolean hasRiceHashes() { + return riceHashesBuilder_ != null || riceHashes_ != null; + } + /** + * + * + *
+     * The encoded 4-byte prefixes of SHA256-formatted entries, using a
+     * Golomb-Rice encoding. The hashes are converted to uint32, sorted in
+     * ascending order, then delta encoded and stored as encoded_data.
+     * 
+ * + * .google.cloud.webrisk.v1.RiceDeltaEncoding rice_hashes = 2; + * + * @return The riceHashes. + */ + public com.google.webrisk.v1.RiceDeltaEncoding getRiceHashes() { + if (riceHashesBuilder_ == null) { + return riceHashes_ == null + ? com.google.webrisk.v1.RiceDeltaEncoding.getDefaultInstance() + : riceHashes_; + } else { + return riceHashesBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The encoded 4-byte prefixes of SHA256-formatted entries, using a
+     * Golomb-Rice encoding. The hashes are converted to uint32, sorted in
+     * ascending order, then delta encoded and stored as encoded_data.
+     * 
+ * + * .google.cloud.webrisk.v1.RiceDeltaEncoding rice_hashes = 2; + */ + public Builder setRiceHashes(com.google.webrisk.v1.RiceDeltaEncoding value) { + if (riceHashesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + riceHashes_ = value; + onChanged(); + } else { + riceHashesBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The encoded 4-byte prefixes of SHA256-formatted entries, using a
+     * Golomb-Rice encoding. The hashes are converted to uint32, sorted in
+     * ascending order, then delta encoded and stored as encoded_data.
+     * 
+ * + * .google.cloud.webrisk.v1.RiceDeltaEncoding rice_hashes = 2; + */ + public Builder setRiceHashes(com.google.webrisk.v1.RiceDeltaEncoding.Builder builderForValue) { + if (riceHashesBuilder_ == null) { + riceHashes_ = builderForValue.build(); + onChanged(); + } else { + riceHashesBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The encoded 4-byte prefixes of SHA256-formatted entries, using a
+     * Golomb-Rice encoding. The hashes are converted to uint32, sorted in
+     * ascending order, then delta encoded and stored as encoded_data.
+     * 
+ * + * .google.cloud.webrisk.v1.RiceDeltaEncoding rice_hashes = 2; + */ + public Builder mergeRiceHashes(com.google.webrisk.v1.RiceDeltaEncoding value) { + if (riceHashesBuilder_ == null) { + if (riceHashes_ != null) { + riceHashes_ = + com.google.webrisk.v1.RiceDeltaEncoding.newBuilder(riceHashes_) + .mergeFrom(value) + .buildPartial(); + } else { + riceHashes_ = value; + } + onChanged(); + } else { + riceHashesBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The encoded 4-byte prefixes of SHA256-formatted entries, using a
+     * Golomb-Rice encoding. The hashes are converted to uint32, sorted in
+     * ascending order, then delta encoded and stored as encoded_data.
+     * 
+ * + * .google.cloud.webrisk.v1.RiceDeltaEncoding rice_hashes = 2; + */ + public Builder clearRiceHashes() { + if (riceHashesBuilder_ == null) { + riceHashes_ = null; + onChanged(); + } else { + riceHashes_ = null; + riceHashesBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The encoded 4-byte prefixes of SHA256-formatted entries, using a
+     * Golomb-Rice encoding. The hashes are converted to uint32, sorted in
+     * ascending order, then delta encoded and stored as encoded_data.
+     * 
+ * + * .google.cloud.webrisk.v1.RiceDeltaEncoding rice_hashes = 2; + */ + public com.google.webrisk.v1.RiceDeltaEncoding.Builder getRiceHashesBuilder() { + + onChanged(); + return getRiceHashesFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The encoded 4-byte prefixes of SHA256-formatted entries, using a
+     * Golomb-Rice encoding. The hashes are converted to uint32, sorted in
+     * ascending order, then delta encoded and stored as encoded_data.
+     * 
+ * + * .google.cloud.webrisk.v1.RiceDeltaEncoding rice_hashes = 2; + */ + public com.google.webrisk.v1.RiceDeltaEncodingOrBuilder getRiceHashesOrBuilder() { + if (riceHashesBuilder_ != null) { + return riceHashesBuilder_.getMessageOrBuilder(); + } else { + return riceHashes_ == null + ? com.google.webrisk.v1.RiceDeltaEncoding.getDefaultInstance() + : riceHashes_; + } + } + /** + * + * + *
+     * The encoded 4-byte prefixes of SHA256-formatted entries, using a
+     * Golomb-Rice encoding. The hashes are converted to uint32, sorted in
+     * ascending order, then delta encoded and stored as encoded_data.
+     * 
+ * + * .google.cloud.webrisk.v1.RiceDeltaEncoding rice_hashes = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.RiceDeltaEncoding, + com.google.webrisk.v1.RiceDeltaEncoding.Builder, + com.google.webrisk.v1.RiceDeltaEncodingOrBuilder> + getRiceHashesFieldBuilder() { + if (riceHashesBuilder_ == null) { + riceHashesBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.RiceDeltaEncoding, + com.google.webrisk.v1.RiceDeltaEncoding.Builder, + com.google.webrisk.v1.RiceDeltaEncodingOrBuilder>( + getRiceHashes(), getParentForChildren(), isClean()); + riceHashes_ = null; + } + return riceHashesBuilder_; + } + + @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.ThreatEntryAdditions) + } + + // @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.ThreatEntryAdditions) + private static final com.google.webrisk.v1.ThreatEntryAdditions DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.webrisk.v1.ThreatEntryAdditions(); + } + + public static com.google.webrisk.v1.ThreatEntryAdditions getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ThreatEntryAdditions parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ThreatEntryAdditions(input, extensionRegistry); + } + }; + + 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.ThreatEntryAdditions getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatEntryAdditionsOrBuilder.java b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatEntryAdditionsOrBuilder.java new file mode 100644 index 00000000..9e715503 --- /dev/null +++ b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatEntryAdditionsOrBuilder.java @@ -0,0 +1,122 @@ +/* + * 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 ThreatEntryAdditionsOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.webrisk.v1.ThreatEntryAdditions) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The raw SHA256-formatted entries.
+   * Repeated to allow returning sets of hashes with different prefix sizes.
+   * 
+ * + * repeated .google.cloud.webrisk.v1.RawHashes raw_hashes = 1; + */ + java.util.List getRawHashesList(); + /** + * + * + *
+   * The raw SHA256-formatted entries.
+   * Repeated to allow returning sets of hashes with different prefix sizes.
+   * 
+ * + * repeated .google.cloud.webrisk.v1.RawHashes raw_hashes = 1; + */ + com.google.webrisk.v1.RawHashes getRawHashes(int index); + /** + * + * + *
+   * The raw SHA256-formatted entries.
+   * Repeated to allow returning sets of hashes with different prefix sizes.
+   * 
+ * + * repeated .google.cloud.webrisk.v1.RawHashes raw_hashes = 1; + */ + int getRawHashesCount(); + /** + * + * + *
+   * The raw SHA256-formatted entries.
+   * Repeated to allow returning sets of hashes with different prefix sizes.
+   * 
+ * + * repeated .google.cloud.webrisk.v1.RawHashes raw_hashes = 1; + */ + java.util.List getRawHashesOrBuilderList(); + /** + * + * + *
+   * The raw SHA256-formatted entries.
+   * Repeated to allow returning sets of hashes with different prefix sizes.
+   * 
+ * + * repeated .google.cloud.webrisk.v1.RawHashes raw_hashes = 1; + */ + com.google.webrisk.v1.RawHashesOrBuilder getRawHashesOrBuilder(int index); + + /** + * + * + *
+   * The encoded 4-byte prefixes of SHA256-formatted entries, using a
+   * Golomb-Rice encoding. The hashes are converted to uint32, sorted in
+   * ascending order, then delta encoded and stored as encoded_data.
+   * 
+ * + * .google.cloud.webrisk.v1.RiceDeltaEncoding rice_hashes = 2; + * + * @return Whether the riceHashes field is set. + */ + boolean hasRiceHashes(); + /** + * + * + *
+   * The encoded 4-byte prefixes of SHA256-formatted entries, using a
+   * Golomb-Rice encoding. The hashes are converted to uint32, sorted in
+   * ascending order, then delta encoded and stored as encoded_data.
+   * 
+ * + * .google.cloud.webrisk.v1.RiceDeltaEncoding rice_hashes = 2; + * + * @return The riceHashes. + */ + com.google.webrisk.v1.RiceDeltaEncoding getRiceHashes(); + /** + * + * + *
+   * The encoded 4-byte prefixes of SHA256-formatted entries, using a
+   * Golomb-Rice encoding. The hashes are converted to uint32, sorted in
+   * ascending order, then delta encoded and stored as encoded_data.
+   * 
+ * + * .google.cloud.webrisk.v1.RiceDeltaEncoding rice_hashes = 2; + */ + com.google.webrisk.v1.RiceDeltaEncodingOrBuilder getRiceHashesOrBuilder(); +} diff --git a/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatEntryRemovals.java b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatEntryRemovals.java new file mode 100644 index 00000000..b51be5e2 --- /dev/null +++ b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatEntryRemovals.java @@ -0,0 +1,1037 @@ +/* + * 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; + +/** + * + * + *
+ * Contains the set of entries to remove from a local database.
+ * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.ThreatEntryRemovals} + */ +public final class ThreatEntryRemovals extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.webrisk.v1.ThreatEntryRemovals) + ThreatEntryRemovalsOrBuilder { + private static final long serialVersionUID = 0L; + // Use ThreatEntryRemovals.newBuilder() to construct. + private ThreatEntryRemovals(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ThreatEntryRemovals() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ThreatEntryRemovals(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ThreatEntryRemovals( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.webrisk.v1.RawIndices.Builder subBuilder = null; + if (rawIndices_ != null) { + subBuilder = rawIndices_.toBuilder(); + } + rawIndices_ = + input.readMessage(com.google.webrisk.v1.RawIndices.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(rawIndices_); + rawIndices_ = subBuilder.buildPartial(); + } + + break; + } + case 18: + { + com.google.webrisk.v1.RiceDeltaEncoding.Builder subBuilder = null; + if (riceIndices_ != null) { + subBuilder = riceIndices_.toBuilder(); + } + riceIndices_ = + input.readMessage( + com.google.webrisk.v1.RiceDeltaEncoding.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(riceIndices_); + riceIndices_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ThreatEntryRemovals_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ThreatEntryRemovals_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.ThreatEntryRemovals.class, + com.google.webrisk.v1.ThreatEntryRemovals.Builder.class); + } + + public static final int RAW_INDICES_FIELD_NUMBER = 1; + private com.google.webrisk.v1.RawIndices rawIndices_; + /** + * + * + *
+   * The raw removal indices for a local list.
+   * 
+ * + * .google.cloud.webrisk.v1.RawIndices raw_indices = 1; + * + * @return Whether the rawIndices field is set. + */ + public boolean hasRawIndices() { + return rawIndices_ != null; + } + /** + * + * + *
+   * The raw removal indices for a local list.
+   * 
+ * + * .google.cloud.webrisk.v1.RawIndices raw_indices = 1; + * + * @return The rawIndices. + */ + public com.google.webrisk.v1.RawIndices getRawIndices() { + return rawIndices_ == null + ? com.google.webrisk.v1.RawIndices.getDefaultInstance() + : rawIndices_; + } + /** + * + * + *
+   * The raw removal indices for a local list.
+   * 
+ * + * .google.cloud.webrisk.v1.RawIndices raw_indices = 1; + */ + public com.google.webrisk.v1.RawIndicesOrBuilder getRawIndicesOrBuilder() { + return getRawIndices(); + } + + public static final int RICE_INDICES_FIELD_NUMBER = 2; + private com.google.webrisk.v1.RiceDeltaEncoding riceIndices_; + /** + * + * + *
+   * The encoded local, lexicographically-sorted list indices, using a
+   * Golomb-Rice encoding. Used for sending compressed removal indices. The
+   * removal indices (uint32) are sorted in ascending order, then delta encoded
+   * and stored as encoded_data.
+   * 
+ * + * .google.cloud.webrisk.v1.RiceDeltaEncoding rice_indices = 2; + * + * @return Whether the riceIndices field is set. + */ + public boolean hasRiceIndices() { + return riceIndices_ != null; + } + /** + * + * + *
+   * The encoded local, lexicographically-sorted list indices, using a
+   * Golomb-Rice encoding. Used for sending compressed removal indices. The
+   * removal indices (uint32) are sorted in ascending order, then delta encoded
+   * and stored as encoded_data.
+   * 
+ * + * .google.cloud.webrisk.v1.RiceDeltaEncoding rice_indices = 2; + * + * @return The riceIndices. + */ + public com.google.webrisk.v1.RiceDeltaEncoding getRiceIndices() { + return riceIndices_ == null + ? com.google.webrisk.v1.RiceDeltaEncoding.getDefaultInstance() + : riceIndices_; + } + /** + * + * + *
+   * The encoded local, lexicographically-sorted list indices, using a
+   * Golomb-Rice encoding. Used for sending compressed removal indices. The
+   * removal indices (uint32) are sorted in ascending order, then delta encoded
+   * and stored as encoded_data.
+   * 
+ * + * .google.cloud.webrisk.v1.RiceDeltaEncoding rice_indices = 2; + */ + public com.google.webrisk.v1.RiceDeltaEncodingOrBuilder getRiceIndicesOrBuilder() { + return getRiceIndices(); + } + + 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 (rawIndices_ != null) { + output.writeMessage(1, getRawIndices()); + } + if (riceIndices_ != null) { + output.writeMessage(2, getRiceIndices()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (rawIndices_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getRawIndices()); + } + if (riceIndices_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getRiceIndices()); + } + size += unknownFields.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.ThreatEntryRemovals)) { + return super.equals(obj); + } + com.google.webrisk.v1.ThreatEntryRemovals other = + (com.google.webrisk.v1.ThreatEntryRemovals) obj; + + if (hasRawIndices() != other.hasRawIndices()) return false; + if (hasRawIndices()) { + if (!getRawIndices().equals(other.getRawIndices())) return false; + } + if (hasRiceIndices() != other.hasRiceIndices()) return false; + if (hasRiceIndices()) { + if (!getRiceIndices().equals(other.getRiceIndices())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasRawIndices()) { + hash = (37 * hash) + RAW_INDICES_FIELD_NUMBER; + hash = (53 * hash) + getRawIndices().hashCode(); + } + if (hasRiceIndices()) { + hash = (37 * hash) + RICE_INDICES_FIELD_NUMBER; + hash = (53 * hash) + getRiceIndices().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.webrisk.v1.ThreatEntryRemovals parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.ThreatEntryRemovals 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.ThreatEntryRemovals parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.ThreatEntryRemovals 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.ThreatEntryRemovals parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.webrisk.v1.ThreatEntryRemovals parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.webrisk.v1.ThreatEntryRemovals parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.ThreatEntryRemovals 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.ThreatEntryRemovals parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.ThreatEntryRemovals 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.ThreatEntryRemovals parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.webrisk.v1.ThreatEntryRemovals 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.ThreatEntryRemovals 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; + } + /** + * + * + *
+   * Contains the set of entries to remove from a local database.
+   * 
+ * + * Protobuf type {@code google.cloud.webrisk.v1.ThreatEntryRemovals} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.webrisk.v1.ThreatEntryRemovals) + com.google.webrisk.v1.ThreatEntryRemovalsOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ThreatEntryRemovals_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.webrisk.v1.WebRiskProto + .internal_static_google_cloud_webrisk_v1_ThreatEntryRemovals_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.webrisk.v1.ThreatEntryRemovals.class, + com.google.webrisk.v1.ThreatEntryRemovals.Builder.class); + } + + // Construct using com.google.webrisk.v1.ThreatEntryRemovals.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (rawIndicesBuilder_ == null) { + rawIndices_ = null; + } else { + rawIndices_ = null; + rawIndicesBuilder_ = null; + } + if (riceIndicesBuilder_ == null) { + riceIndices_ = null; + } else { + riceIndices_ = null; + riceIndicesBuilder_ = 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_ThreatEntryRemovals_descriptor; + } + + @java.lang.Override + public com.google.webrisk.v1.ThreatEntryRemovals getDefaultInstanceForType() { + return com.google.webrisk.v1.ThreatEntryRemovals.getDefaultInstance(); + } + + @java.lang.Override + public com.google.webrisk.v1.ThreatEntryRemovals build() { + com.google.webrisk.v1.ThreatEntryRemovals result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.webrisk.v1.ThreatEntryRemovals buildPartial() { + com.google.webrisk.v1.ThreatEntryRemovals result = + new com.google.webrisk.v1.ThreatEntryRemovals(this); + if (rawIndicesBuilder_ == null) { + result.rawIndices_ = rawIndices_; + } else { + result.rawIndices_ = rawIndicesBuilder_.build(); + } + if (riceIndicesBuilder_ == null) { + result.riceIndices_ = riceIndices_; + } else { + result.riceIndices_ = riceIndicesBuilder_.build(); + } + onBuilt(); + return result; + } + + @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.ThreatEntryRemovals) { + return mergeFrom((com.google.webrisk.v1.ThreatEntryRemovals) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.webrisk.v1.ThreatEntryRemovals other) { + if (other == com.google.webrisk.v1.ThreatEntryRemovals.getDefaultInstance()) return this; + if (other.hasRawIndices()) { + mergeRawIndices(other.getRawIndices()); + } + if (other.hasRiceIndices()) { + mergeRiceIndices(other.getRiceIndices()); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.webrisk.v1.ThreatEntryRemovals parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.webrisk.v1.ThreatEntryRemovals) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.webrisk.v1.RawIndices rawIndices_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.RawIndices, + com.google.webrisk.v1.RawIndices.Builder, + com.google.webrisk.v1.RawIndicesOrBuilder> + rawIndicesBuilder_; + /** + * + * + *
+     * The raw removal indices for a local list.
+     * 
+ * + * .google.cloud.webrisk.v1.RawIndices raw_indices = 1; + * + * @return Whether the rawIndices field is set. + */ + public boolean hasRawIndices() { + return rawIndicesBuilder_ != null || rawIndices_ != null; + } + /** + * + * + *
+     * The raw removal indices for a local list.
+     * 
+ * + * .google.cloud.webrisk.v1.RawIndices raw_indices = 1; + * + * @return The rawIndices. + */ + public com.google.webrisk.v1.RawIndices getRawIndices() { + if (rawIndicesBuilder_ == null) { + return rawIndices_ == null + ? com.google.webrisk.v1.RawIndices.getDefaultInstance() + : rawIndices_; + } else { + return rawIndicesBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The raw removal indices for a local list.
+     * 
+ * + * .google.cloud.webrisk.v1.RawIndices raw_indices = 1; + */ + public Builder setRawIndices(com.google.webrisk.v1.RawIndices value) { + if (rawIndicesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + rawIndices_ = value; + onChanged(); + } else { + rawIndicesBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The raw removal indices for a local list.
+     * 
+ * + * .google.cloud.webrisk.v1.RawIndices raw_indices = 1; + */ + public Builder setRawIndices(com.google.webrisk.v1.RawIndices.Builder builderForValue) { + if (rawIndicesBuilder_ == null) { + rawIndices_ = builderForValue.build(); + onChanged(); + } else { + rawIndicesBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The raw removal indices for a local list.
+     * 
+ * + * .google.cloud.webrisk.v1.RawIndices raw_indices = 1; + */ + public Builder mergeRawIndices(com.google.webrisk.v1.RawIndices value) { + if (rawIndicesBuilder_ == null) { + if (rawIndices_ != null) { + rawIndices_ = + com.google.webrisk.v1.RawIndices.newBuilder(rawIndices_) + .mergeFrom(value) + .buildPartial(); + } else { + rawIndices_ = value; + } + onChanged(); + } else { + rawIndicesBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The raw removal indices for a local list.
+     * 
+ * + * .google.cloud.webrisk.v1.RawIndices raw_indices = 1; + */ + public Builder clearRawIndices() { + if (rawIndicesBuilder_ == null) { + rawIndices_ = null; + onChanged(); + } else { + rawIndices_ = null; + rawIndicesBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The raw removal indices for a local list.
+     * 
+ * + * .google.cloud.webrisk.v1.RawIndices raw_indices = 1; + */ + public com.google.webrisk.v1.RawIndices.Builder getRawIndicesBuilder() { + + onChanged(); + return getRawIndicesFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The raw removal indices for a local list.
+     * 
+ * + * .google.cloud.webrisk.v1.RawIndices raw_indices = 1; + */ + public com.google.webrisk.v1.RawIndicesOrBuilder getRawIndicesOrBuilder() { + if (rawIndicesBuilder_ != null) { + return rawIndicesBuilder_.getMessageOrBuilder(); + } else { + return rawIndices_ == null + ? com.google.webrisk.v1.RawIndices.getDefaultInstance() + : rawIndices_; + } + } + /** + * + * + *
+     * The raw removal indices for a local list.
+     * 
+ * + * .google.cloud.webrisk.v1.RawIndices raw_indices = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.RawIndices, + com.google.webrisk.v1.RawIndices.Builder, + com.google.webrisk.v1.RawIndicesOrBuilder> + getRawIndicesFieldBuilder() { + if (rawIndicesBuilder_ == null) { + rawIndicesBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.RawIndices, + com.google.webrisk.v1.RawIndices.Builder, + com.google.webrisk.v1.RawIndicesOrBuilder>( + getRawIndices(), getParentForChildren(), isClean()); + rawIndices_ = null; + } + return rawIndicesBuilder_; + } + + private com.google.webrisk.v1.RiceDeltaEncoding riceIndices_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.RiceDeltaEncoding, + com.google.webrisk.v1.RiceDeltaEncoding.Builder, + com.google.webrisk.v1.RiceDeltaEncodingOrBuilder> + riceIndicesBuilder_; + /** + * + * + *
+     * The encoded local, lexicographically-sorted list indices, using a
+     * Golomb-Rice encoding. Used for sending compressed removal indices. The
+     * removal indices (uint32) are sorted in ascending order, then delta encoded
+     * and stored as encoded_data.
+     * 
+ * + * .google.cloud.webrisk.v1.RiceDeltaEncoding rice_indices = 2; + * + * @return Whether the riceIndices field is set. + */ + public boolean hasRiceIndices() { + return riceIndicesBuilder_ != null || riceIndices_ != null; + } + /** + * + * + *
+     * The encoded local, lexicographically-sorted list indices, using a
+     * Golomb-Rice encoding. Used for sending compressed removal indices. The
+     * removal indices (uint32) are sorted in ascending order, then delta encoded
+     * and stored as encoded_data.
+     * 
+ * + * .google.cloud.webrisk.v1.RiceDeltaEncoding rice_indices = 2; + * + * @return The riceIndices. + */ + public com.google.webrisk.v1.RiceDeltaEncoding getRiceIndices() { + if (riceIndicesBuilder_ == null) { + return riceIndices_ == null + ? com.google.webrisk.v1.RiceDeltaEncoding.getDefaultInstance() + : riceIndices_; + } else { + return riceIndicesBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The encoded local, lexicographically-sorted list indices, using a
+     * Golomb-Rice encoding. Used for sending compressed removal indices. The
+     * removal indices (uint32) are sorted in ascending order, then delta encoded
+     * and stored as encoded_data.
+     * 
+ * + * .google.cloud.webrisk.v1.RiceDeltaEncoding rice_indices = 2; + */ + public Builder setRiceIndices(com.google.webrisk.v1.RiceDeltaEncoding value) { + if (riceIndicesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + riceIndices_ = value; + onChanged(); + } else { + riceIndicesBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The encoded local, lexicographically-sorted list indices, using a
+     * Golomb-Rice encoding. Used for sending compressed removal indices. The
+     * removal indices (uint32) are sorted in ascending order, then delta encoded
+     * and stored as encoded_data.
+     * 
+ * + * .google.cloud.webrisk.v1.RiceDeltaEncoding rice_indices = 2; + */ + public Builder setRiceIndices(com.google.webrisk.v1.RiceDeltaEncoding.Builder builderForValue) { + if (riceIndicesBuilder_ == null) { + riceIndices_ = builderForValue.build(); + onChanged(); + } else { + riceIndicesBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The encoded local, lexicographically-sorted list indices, using a
+     * Golomb-Rice encoding. Used for sending compressed removal indices. The
+     * removal indices (uint32) are sorted in ascending order, then delta encoded
+     * and stored as encoded_data.
+     * 
+ * + * .google.cloud.webrisk.v1.RiceDeltaEncoding rice_indices = 2; + */ + public Builder mergeRiceIndices(com.google.webrisk.v1.RiceDeltaEncoding value) { + if (riceIndicesBuilder_ == null) { + if (riceIndices_ != null) { + riceIndices_ = + com.google.webrisk.v1.RiceDeltaEncoding.newBuilder(riceIndices_) + .mergeFrom(value) + .buildPartial(); + } else { + riceIndices_ = value; + } + onChanged(); + } else { + riceIndicesBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The encoded local, lexicographically-sorted list indices, using a
+     * Golomb-Rice encoding. Used for sending compressed removal indices. The
+     * removal indices (uint32) are sorted in ascending order, then delta encoded
+     * and stored as encoded_data.
+     * 
+ * + * .google.cloud.webrisk.v1.RiceDeltaEncoding rice_indices = 2; + */ + public Builder clearRiceIndices() { + if (riceIndicesBuilder_ == null) { + riceIndices_ = null; + onChanged(); + } else { + riceIndices_ = null; + riceIndicesBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The encoded local, lexicographically-sorted list indices, using a
+     * Golomb-Rice encoding. Used for sending compressed removal indices. The
+     * removal indices (uint32) are sorted in ascending order, then delta encoded
+     * and stored as encoded_data.
+     * 
+ * + * .google.cloud.webrisk.v1.RiceDeltaEncoding rice_indices = 2; + */ + public com.google.webrisk.v1.RiceDeltaEncoding.Builder getRiceIndicesBuilder() { + + onChanged(); + return getRiceIndicesFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The encoded local, lexicographically-sorted list indices, using a
+     * Golomb-Rice encoding. Used for sending compressed removal indices. The
+     * removal indices (uint32) are sorted in ascending order, then delta encoded
+     * and stored as encoded_data.
+     * 
+ * + * .google.cloud.webrisk.v1.RiceDeltaEncoding rice_indices = 2; + */ + public com.google.webrisk.v1.RiceDeltaEncodingOrBuilder getRiceIndicesOrBuilder() { + if (riceIndicesBuilder_ != null) { + return riceIndicesBuilder_.getMessageOrBuilder(); + } else { + return riceIndices_ == null + ? com.google.webrisk.v1.RiceDeltaEncoding.getDefaultInstance() + : riceIndices_; + } + } + /** + * + * + *
+     * The encoded local, lexicographically-sorted list indices, using a
+     * Golomb-Rice encoding. Used for sending compressed removal indices. The
+     * removal indices (uint32) are sorted in ascending order, then delta encoded
+     * and stored as encoded_data.
+     * 
+ * + * .google.cloud.webrisk.v1.RiceDeltaEncoding rice_indices = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.RiceDeltaEncoding, + com.google.webrisk.v1.RiceDeltaEncoding.Builder, + com.google.webrisk.v1.RiceDeltaEncodingOrBuilder> + getRiceIndicesFieldBuilder() { + if (riceIndicesBuilder_ == null) { + riceIndicesBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.webrisk.v1.RiceDeltaEncoding, + com.google.webrisk.v1.RiceDeltaEncoding.Builder, + com.google.webrisk.v1.RiceDeltaEncodingOrBuilder>( + getRiceIndices(), getParentForChildren(), isClean()); + riceIndices_ = null; + } + return riceIndicesBuilder_; + } + + @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.ThreatEntryRemovals) + } + + // @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.ThreatEntryRemovals) + private static final com.google.webrisk.v1.ThreatEntryRemovals DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.webrisk.v1.ThreatEntryRemovals(); + } + + public static com.google.webrisk.v1.ThreatEntryRemovals getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ThreatEntryRemovals parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ThreatEntryRemovals(input, extensionRegistry); + } + }; + + 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.ThreatEntryRemovals getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatEntryRemovalsOrBuilder.java b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatEntryRemovalsOrBuilder.java new file mode 100644 index 00000000..87cb7ab8 --- /dev/null +++ b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatEntryRemovalsOrBuilder.java @@ -0,0 +1,104 @@ +/* + * 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 ThreatEntryRemovalsOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.webrisk.v1.ThreatEntryRemovals) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The raw removal indices for a local list.
+   * 
+ * + * .google.cloud.webrisk.v1.RawIndices raw_indices = 1; + * + * @return Whether the rawIndices field is set. + */ + boolean hasRawIndices(); + /** + * + * + *
+   * The raw removal indices for a local list.
+   * 
+ * + * .google.cloud.webrisk.v1.RawIndices raw_indices = 1; + * + * @return The rawIndices. + */ + com.google.webrisk.v1.RawIndices getRawIndices(); + /** + * + * + *
+   * The raw removal indices for a local list.
+   * 
+ * + * .google.cloud.webrisk.v1.RawIndices raw_indices = 1; + */ + com.google.webrisk.v1.RawIndicesOrBuilder getRawIndicesOrBuilder(); + + /** + * + * + *
+   * The encoded local, lexicographically-sorted list indices, using a
+   * Golomb-Rice encoding. Used for sending compressed removal indices. The
+   * removal indices (uint32) are sorted in ascending order, then delta encoded
+   * and stored as encoded_data.
+   * 
+ * + * .google.cloud.webrisk.v1.RiceDeltaEncoding rice_indices = 2; + * + * @return Whether the riceIndices field is set. + */ + boolean hasRiceIndices(); + /** + * + * + *
+   * The encoded local, lexicographically-sorted list indices, using a
+   * Golomb-Rice encoding. Used for sending compressed removal indices. The
+   * removal indices (uint32) are sorted in ascending order, then delta encoded
+   * and stored as encoded_data.
+   * 
+ * + * .google.cloud.webrisk.v1.RiceDeltaEncoding rice_indices = 2; + * + * @return The riceIndices. + */ + com.google.webrisk.v1.RiceDeltaEncoding getRiceIndices(); + /** + * + * + *
+   * The encoded local, lexicographically-sorted list indices, using a
+   * Golomb-Rice encoding. Used for sending compressed removal indices. The
+   * removal indices (uint32) are sorted in ascending order, then delta encoded
+   * and stored as encoded_data.
+   * 
+ * + * .google.cloud.webrisk.v1.RiceDeltaEncoding rice_indices = 2; + */ + com.google.webrisk.v1.RiceDeltaEncodingOrBuilder getRiceIndicesOrBuilder(); +} diff --git a/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatType.java b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatType.java new file mode 100644 index 00000000..9f4cfe98 --- /dev/null +++ b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/ThreatType.java @@ -0,0 +1,195 @@ +/* + * 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; + +/** + * + * + *
+ * The type of threat. This maps dirrectly to the threat list a threat may
+ * belong to.
+ * 
+ * + * Protobuf enum {@code google.cloud.webrisk.v1.ThreatType} + */ +public enum ThreatType implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+   * Unknown.
+   * 
+ * + * THREAT_TYPE_UNSPECIFIED = 0; + */ + THREAT_TYPE_UNSPECIFIED(0), + /** + * + * + *
+   * Malware targeting any platform.
+   * 
+ * + * MALWARE = 1; + */ + MALWARE(1), + /** + * + * + *
+   * Social engineering targeting any platform.
+   * 
+ * + * SOCIAL_ENGINEERING = 2; + */ + SOCIAL_ENGINEERING(2), + /** + * + * + *
+   * Unwanted software targeting any platform.
+   * 
+ * + * UNWANTED_SOFTWARE = 3; + */ + UNWANTED_SOFTWARE(3), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+   * Unknown.
+   * 
+ * + * THREAT_TYPE_UNSPECIFIED = 0; + */ + public static final int THREAT_TYPE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+   * Malware targeting any platform.
+   * 
+ * + * MALWARE = 1; + */ + public static final int MALWARE_VALUE = 1; + /** + * + * + *
+   * Social engineering targeting any platform.
+   * 
+ * + * SOCIAL_ENGINEERING = 2; + */ + public static final int SOCIAL_ENGINEERING_VALUE = 2; + /** + * + * + *
+   * Unwanted software targeting any platform.
+   * 
+ * + * 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 ThreatType 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 ThreatType forNumber(int value) { + switch (value) { + case 0: + return THREAT_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 ThreatType findValueByNumber(int number) { + return ThreatType.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + 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.WebRiskProto.getDescriptor().getEnumTypes().get(0); + } + + private static final ThreatType[] VALUES = values(); + + public static ThreatType 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 ThreatType(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.webrisk.v1.ThreatType) +} diff --git a/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/WebRiskProto.java b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/WebRiskProto.java new file mode 100644 index 00000000..5e59975f --- /dev/null +++ b/proto-google-cloud-webrisk-v1/src/main/java/com/google/webrisk/v1/WebRiskProto.java @@ -0,0 +1,377 @@ +/* + * 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 final class WebRiskProto { + private WebRiskProto() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffRequest_Constraints_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffRequest_Constraints_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffResponse_Checksum_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffResponse_Checksum_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_webrisk_v1_SearchUrisRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_webrisk_v1_SearchUrisRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_webrisk_v1_SearchUrisResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_webrisk_v1_SearchUrisResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_webrisk_v1_SearchUrisResponse_ThreatUri_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_webrisk_v1_SearchUrisResponse_ThreatUri_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_webrisk_v1_SearchHashesRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_webrisk_v1_SearchHashesRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_webrisk_v1_SearchHashesResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_webrisk_v1_SearchHashesResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_webrisk_v1_SearchHashesResponse_ThreatHash_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_webrisk_v1_SearchHashesResponse_ThreatHash_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_webrisk_v1_ThreatEntryAdditions_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_webrisk_v1_ThreatEntryAdditions_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_webrisk_v1_ThreatEntryRemovals_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_webrisk_v1_ThreatEntryRemovals_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_webrisk_v1_RawIndices_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_webrisk_v1_RawIndices_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_webrisk_v1_RawHashes_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_webrisk_v1_RawHashes_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_webrisk_v1_RiceDeltaEncoding_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_webrisk_v1_RiceDeltaEncoding_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + 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_CreateSubmissionRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_webrisk_v1_CreateSubmissionRequest_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n%google/cloud/webrisk/v1/webrisk.proto\022" + + "\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*e\n\nThreatType\022\033\n\027THREAT_TYPE" + + "_UNSPECIFIED\020\000\022\013\n\007MALWARE\020\001\022\026\n\022SOCIAL_EN" + + "GINEERING\020\002\022\025\n\021UNWANTED_SOFTWARE\020\003*F\n\017Co" + + "mpressionType\022 \n\034COMPRESSION_TYPE_UNSPEC" + + "IFIED\020\000\022\007\n\003RAW\020\001\022\010\n\004RICE\020\0022\243\006\n\016WebRiskSe" + + "rvice\022\323\001\n\025ComputeThreatListDiff\0225.google" + + ".cloud.webrisk.v1.ComputeThreatListDiffR" + + "equest\0326.google.cloud.webrisk.v1.Compute" + + "ThreatListDiffResponse\"K\202\323\344\223\002\035\022\033/v1/thre" + + "atLists:computeDiff\332A%threat_type,versio" + + "n_token,constraints\022\221\001\n\nSearchUris\022*.goo" + + "gle.cloud.webrisk.v1.SearchUrisRequest\032+" + + ".google.cloud.webrisk.v1.SearchUrisRespo" + + "nse\"*\202\323\344\223\002\021\022\017/v1/uris:search\332A\020uri,threa" + + "t_types\022\241\001\n\014SearchHashes\022,.google.cloud." + + "webrisk.v1.SearchHashesRequest\032-.google." + + "cloud.webrisk.v1.SearchHashesResponse\"4\202" + + "\323\344\223\002\023\022\021/v1/hashes:search\332A\030hash_prefix,t" + + "hreat_types\022\266\001\n\020CreateSubmission\0220.googl" + + "e.cloud.webrisk.v1.CreateSubmissionReque" + + "st\032#.google.cloud.webrisk.v1.Submission\"" + + "K\202\323\344\223\0021\"#/v1/{parent=projects/*}/submiss" + + "ions:\nsubmission\332A\021parent,submission\032J\312A" + + "\026webrisk.googleapis.com\322A.https://www.go" + + "ogleapis.com/auth/cloud-platformB\242\001\n\025com" + + ".google.webrisk.v1B\014WebRiskProtoP\001Z>goog" + + "le.golang.org/genproto/googleapis/cloud/" + + "webrisk/v1;webrisk\242\002\004GCWR\252\002\027Google.Cloud" + + ".WebRisk.V1\312\002\027Google\\Cloud\\WebRisk\\V1b\006p" + + "roto3" + }; + descriptor = + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.AnnotationsProto.getDescriptor(), + com.google.api.ClientProto.getDescriptor(), + com.google.api.FieldBehaviorProto.getDescriptor(), + com.google.api.ResourceProto.getDescriptor(), + com.google.protobuf.TimestampProto.getDescriptor(), + }); + internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffRequest_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffRequest_descriptor, + new java.lang.String[] { + "ThreatType", "VersionToken", "Constraints", + }); + internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffRequest_Constraints_descriptor = + internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffRequest_descriptor + .getNestedTypes() + .get(0); + internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffRequest_Constraints_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffRequest_Constraints_descriptor, + new java.lang.String[] { + "MaxDiffEntries", "MaxDatabaseEntries", "SupportedCompressions", + }); + internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffResponse_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffResponse_descriptor, + new java.lang.String[] { + "ResponseType", + "Additions", + "Removals", + "NewVersionToken", + "Checksum", + "RecommendedNextDiff", + }); + internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffResponse_Checksum_descriptor = + internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffResponse_descriptor + .getNestedTypes() + .get(0); + internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffResponse_Checksum_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_webrisk_v1_ComputeThreatListDiffResponse_Checksum_descriptor, + new java.lang.String[] { + "Sha256", + }); + internal_static_google_cloud_webrisk_v1_SearchUrisRequest_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_google_cloud_webrisk_v1_SearchUrisRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_webrisk_v1_SearchUrisRequest_descriptor, + new java.lang.String[] { + "Uri", "ThreatTypes", + }); + internal_static_google_cloud_webrisk_v1_SearchUrisResponse_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_google_cloud_webrisk_v1_SearchUrisResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_webrisk_v1_SearchUrisResponse_descriptor, + new java.lang.String[] { + "Threat", + }); + internal_static_google_cloud_webrisk_v1_SearchUrisResponse_ThreatUri_descriptor = + internal_static_google_cloud_webrisk_v1_SearchUrisResponse_descriptor + .getNestedTypes() + .get(0); + internal_static_google_cloud_webrisk_v1_SearchUrisResponse_ThreatUri_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_webrisk_v1_SearchUrisResponse_ThreatUri_descriptor, + new java.lang.String[] { + "ThreatTypes", "ExpireTime", + }); + internal_static_google_cloud_webrisk_v1_SearchHashesRequest_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_google_cloud_webrisk_v1_SearchHashesRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_webrisk_v1_SearchHashesRequest_descriptor, + new java.lang.String[] { + "HashPrefix", "ThreatTypes", + }); + internal_static_google_cloud_webrisk_v1_SearchHashesResponse_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_google_cloud_webrisk_v1_SearchHashesResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_webrisk_v1_SearchHashesResponse_descriptor, + new java.lang.String[] { + "Threats", "NegativeExpireTime", + }); + internal_static_google_cloud_webrisk_v1_SearchHashesResponse_ThreatHash_descriptor = + internal_static_google_cloud_webrisk_v1_SearchHashesResponse_descriptor + .getNestedTypes() + .get(0); + internal_static_google_cloud_webrisk_v1_SearchHashesResponse_ThreatHash_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_webrisk_v1_SearchHashesResponse_ThreatHash_descriptor, + new java.lang.String[] { + "ThreatTypes", "Hash", "ExpireTime", + }); + internal_static_google_cloud_webrisk_v1_ThreatEntryAdditions_descriptor = + getDescriptor().getMessageTypes().get(6); + internal_static_google_cloud_webrisk_v1_ThreatEntryAdditions_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_webrisk_v1_ThreatEntryAdditions_descriptor, + new java.lang.String[] { + "RawHashes", "RiceHashes", + }); + internal_static_google_cloud_webrisk_v1_ThreatEntryRemovals_descriptor = + getDescriptor().getMessageTypes().get(7); + internal_static_google_cloud_webrisk_v1_ThreatEntryRemovals_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_webrisk_v1_ThreatEntryRemovals_descriptor, + new java.lang.String[] { + "RawIndices", "RiceIndices", + }); + internal_static_google_cloud_webrisk_v1_RawIndices_descriptor = + getDescriptor().getMessageTypes().get(8); + internal_static_google_cloud_webrisk_v1_RawIndices_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_webrisk_v1_RawIndices_descriptor, + new java.lang.String[] { + "Indices", + }); + internal_static_google_cloud_webrisk_v1_RawHashes_descriptor = + getDescriptor().getMessageTypes().get(9); + internal_static_google_cloud_webrisk_v1_RawHashes_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_webrisk_v1_RawHashes_descriptor, + new java.lang.String[] { + "PrefixSize", "RawHashes", + }); + internal_static_google_cloud_webrisk_v1_RiceDeltaEncoding_descriptor = + getDescriptor().getMessageTypes().get(10); + internal_static_google_cloud_webrisk_v1_RiceDeltaEncoding_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_webrisk_v1_RiceDeltaEncoding_descriptor, + new java.lang.String[] { + "FirstValue", "RiceParameter", "EntryCount", "EncodedData", + }); + internal_static_google_cloud_webrisk_v1_Submission_descriptor = + getDescriptor().getMessageTypes().get(11); + internal_static_google_cloud_webrisk_v1_Submission_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_webrisk_v1_Submission_descriptor, + new java.lang.String[] { + "Uri", + }); + internal_static_google_cloud_webrisk_v1_CreateSubmissionRequest_descriptor = + getDescriptor().getMessageTypes().get(12); + 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", + }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.ClientProto.defaultHost); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + registry.add(com.google.api.AnnotationsProto.http); + registry.add(com.google.api.ClientProto.methodSignature); + registry.add(com.google.api.ClientProto.oauthScopes); + registry.add(com.google.api.ResourceProto.resourceReference); + 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.protobuf.TimestampProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/proto-google-cloud-webrisk-v1/src/main/proto/google/cloud/webrisk/v1/webrisk.proto b/proto-google-cloud-webrisk-v1/src/main/proto/google/cloud/webrisk/v1/webrisk.proto new file mode 100644 index 00000000..b85598ab --- /dev/null +++ b/proto-google-cloud-webrisk-v1/src/main/proto/google/cloud/webrisk/v1/webrisk.proto @@ -0,0 +1,352 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.webrisk.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.WebRisk.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/webrisk/v1;webrisk"; +option java_multiple_files = true; +option java_outer_classname = "WebRiskProto"; +option java_package = "com.google.webrisk.v1"; +option objc_class_prefix = "GCWR"; +option php_namespace = "Google\\Cloud\\WebRisk\\V1"; + +// Web Risk API defines an interface to detect malicious URLs on your +// 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"; + + // 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 + // empty or excessively out-of-date, a complete snapshot of the database will + // 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) { + option (google.api.http) = { + get: "/v1/threatLists:computeDiff" + }; + option (google.api.method_signature) = "threat_type,version_token,constraints"; + } + + // This method is used to check whether a URI is on a given threatList. + // Multiple threatLists may be searched in a single query. + // The response will list all requested threatLists the URI was found to + // match. If the URI is not found on any of the requested ThreatList an + // empty response will be returned. + rpc SearchUris(SearchUrisRequest) returns (SearchUrisResponse) { + option (google.api.http) = { + get: "/v1/uris:search" + }; + option (google.api.method_signature) = "uri,threat_types"; + } + + // Gets the full hashes that match the requested hash prefix. + // This is used after a hash prefix is looked up in a threatList + // and there is a match. The client side threatList only holds partial hashes + // so the client must query this method to determine if there is a full + // hash match of a threat. + rpc SearchHashes(SearchHashesRequest) returns (SearchHashesResponse) { + option (google.api.http) = { + get: "/v1/hashes:search" + }; + option (google.api.method_signature) = "hash_prefix,threat_types"; + } + + // Creates a Submission of a URI suspected of containing phishing content to + // be reviewed. If the result verifies the existence of malicious phishing + // 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 + // projects with CREATE_SUBMISSION_USERS visibility can use this method. + rpc CreateSubmission(CreateSubmissionRequest) returns (Submission) { + option (google.api.http) = { + post: "/v1/{parent=projects/*}/submissions" + body: "submission" + }; + option (google.api.method_signature) = "parent,submission"; + } +} + +// Describes an API diff request. +message ComputeThreatListDiffRequest { + // The constraints for this diff. + message Constraints { + // The maximum size in number of entries. The diff will not contain more + // entries than this value. This should be a power of 2 between 2**10 and + // 2**20. If zero, no diff size limit is set. + int32 max_diff_entries = 1; + + // Sets the maximum number of entries that the client is willing to have + // in the local database. This should be a power of 2 between 2**10 and + // 2**20. If zero, no database size limit is set. + int32 max_database_entries = 2; + + // The compression types supported by the client. + repeated CompressionType supported_compressions = 3; + } + + // Required. The threat list to update. Only a single ThreatType should be specified. + ThreatType threat_type = 1 [(google.api.field_behavior) = REQUIRED]; + + // The current version token of the client for the requested list (the + // client version that was received from the last successful diff). + // If the client does not have a version token (this is the first time calling + // ComputeThreatListDiff), this may be left empty and a full database + // snapshot will be returned. + bytes version_token = 2; + + // Required. The constraints associated with this request. + Constraints constraints = 3 [(google.api.field_behavior) = REQUIRED]; +} + +message ComputeThreatListDiffResponse { + // The expected state of a client's local database. + message Checksum { + // The SHA256 hash of the client state; that is, of the sorted list of all + // hashes present in the database. + bytes sha256 = 1; + } + + // The type of response sent to the client. + enum ResponseType { + // Unknown. + RESPONSE_TYPE_UNSPECIFIED = 0; + + // Partial updates are applied to the client's existing local database. + DIFF = 1; + + // Full updates resets the client's entire local database. This means + // that either the client had no state, was seriously out-of-date, + // or the client is believed to be corrupt. + RESET = 2; + } + + // The type of response. This may indicate that an action must be taken by the + // client when the response is received. + ResponseType response_type = 4; + + // A set of entries to add to a local threat type's list. + ThreatEntryAdditions additions = 5; + + // A set of entries to remove from a local threat type's list. + // This field may be empty. + ThreatEntryRemovals removals = 6; + + // The new opaque client version token. This should be retained by the client + // and passed into the next call of ComputeThreatListDiff as 'version_token'. + // A separate version token should be stored and used for each threatList. + bytes new_version_token = 7; + + // The expected SHA256 hash of the client state; that is, of the sorted list + // of all hashes present in the database after applying the provided diff. + // If the client state doesn't match the expected state, the client must + // discard this diff and retry later. + Checksum checksum = 8; + + // The soonest the client should wait before issuing any diff + // request. Querying sooner is unlikely to produce a meaningful diff. + // Waiting longer is acceptable considering the use case. + // If this field is not set clients may update as soon as they want. + google.protobuf.Timestamp recommended_next_diff = 2; +} + +// Request to check URI entries against threatLists. +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. + repeated ThreatType threat_types = 2 [(google.api.field_behavior) = REQUIRED]; +} + +message SearchUrisResponse { + // Contains threat information on a matching uri. + message ThreatUri { + // The ThreatList this threat belongs to. + repeated ThreatType threat_types = 1; + + // The cache lifetime for the returned match. Clients must not cache this + // response past this timestamp to avoid false positives. + google.protobuf.Timestamp expire_time = 2; + } + + // The threat list matches. This may be empty if the URI is on no list. + ThreatUri threat = 1; +} + +// Request to return full hashes matched by the provided hash prefixes. +message SearchHashesRequest { + // A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 + // hash. For JSON requests, this field is base64-encoded. + bytes hash_prefix = 1; + + // Required. The ThreatLists to search in. Multiple ThreatLists may be specified. + repeated ThreatType threat_types = 2 [(google.api.field_behavior) = REQUIRED]; +} + +message SearchHashesResponse { + // Contains threat information on a matching hash. + message ThreatHash { + // The ThreatList this threat belongs to. + // This must contain at least one entry. + repeated ThreatType threat_types = 1; + + // A 32 byte SHA256 hash. This field is in binary format. For JSON + // requests, hashes are base64-encoded. + bytes hash = 2; + + // The cache lifetime for the returned match. Clients must not cache this + // response past this timestamp to avoid false positives. + google.protobuf.Timestamp expire_time = 3; + } + + // The full hashes that matched the requested prefixes. + // The hash will be populated in the key. + repeated ThreatHash threats = 1; + + // For requested entities that did not match the threat list, how long to + // cache the response until. + google.protobuf.Timestamp negative_expire_time = 2; +} + +// Contains the set of entries to add to a local database. +// May contain a combination of compressed and raw data in a single response. +message ThreatEntryAdditions { + // The raw SHA256-formatted entries. + // Repeated to allow returning sets of hashes with different prefix sizes. + repeated RawHashes raw_hashes = 1; + + // The encoded 4-byte prefixes of SHA256-formatted entries, using a + // Golomb-Rice encoding. The hashes are converted to uint32, sorted in + // ascending order, then delta encoded and stored as encoded_data. + RiceDeltaEncoding rice_hashes = 2; +} + +// Contains the set of entries to remove from a local database. +message ThreatEntryRemovals { + // The raw removal indices for a local list. + RawIndices raw_indices = 1; + + // The encoded local, lexicographically-sorted list indices, using a + // Golomb-Rice encoding. Used for sending compressed removal indices. The + // removal indices (uint32) are sorted in ascending order, then delta encoded + // and stored as encoded_data. + RiceDeltaEncoding rice_indices = 2; +} + +// The type of threat. This maps dirrectly to the threat list a threat may +// belong to. +enum ThreatType { + // Unknown. + THREAT_TYPE_UNSPECIFIED = 0; + + // Malware targeting any platform. + MALWARE = 1; + + // Social engineering targeting any platform. + SOCIAL_ENGINEERING = 2; + + // Unwanted software targeting any platform. + UNWANTED_SOFTWARE = 3; +} + +// The ways in which threat entry sets can be compressed. +enum CompressionType { + // Unknown. + COMPRESSION_TYPE_UNSPECIFIED = 0; + + // Raw, uncompressed data. + RAW = 1; + + // Rice-Golomb encoded data. + RICE = 2; +} + +// A set of raw indices to remove from a local list. +message RawIndices { + // The indices to remove from a lexicographically-sorted local list. + repeated int32 indices = 1; +} + +// The uncompressed threat entries in hash format. +// Hashes can be anywhere from 4 to 32 bytes in size. A large majority are 4 +// bytes, but some hashes are lengthened if they collide with the hash of a +// popular URI. +// +// Used for sending ThreatEntryAdditons to clients that do not support +// compression, or when sending non-4-byte hashes to clients that do support +// compression. +message RawHashes { + // The number of bytes for each prefix encoded below. This field can be + // anywhere from 4 (shortest prefix) to 32 (full SHA256 hash). + // In practice this is almost always 4, except in exceptional circumstances. + int32 prefix_size = 1; + + // The hashes, in binary format, concatenated into one long string. Hashes are + // sorted in lexicographic order. For JSON API users, hashes are + // base64-encoded. + bytes raw_hashes = 2; +} + +// The Rice-Golomb encoded data. Used for sending compressed 4-byte hashes or +// compressed removal indices. +message RiceDeltaEncoding { + // The offset of the first entry in the encoded data, or, if only a single + // integer was encoded, that single integer's value. If the field is empty or + // missing, assume zero. + int64 first_value = 1; + + // The Golomb-Rice parameter, which is a number between 2 and 28. This field + // is missing (that is, zero) if `num_entries` is zero. + int32 rice_parameter = 2; + + // The number of entries that are delta encoded in the encoded data. If only a + // single integer was encoded, this will be zero and the single value will be + // stored in `first_value`. + int32 entry_count = 3; + + // The encoded deltas that are encoded using the Golomb-Rice coder. + bytes encoded_data = 4; +} + +// Wraps a URI that might be displaying phishing content. +message Submission { + // Required. The URI that is being reported for phishing content to be analyzed. + string uri = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// 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}". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // Required. The submission that contains the content of the phishing report. + Submission submission = 2 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/synth.metadata b/synth.metadata index e9bf5040..a82c6677 100644 --- a/synth.metadata +++ b/synth.metadata @@ -1,5 +1,5 @@ { - "updateTime": "2020-03-14T09:15:16.013452Z", + "updateTime": "2020-03-16T17:51:44.887676Z", "sources": [ { "generator": { @@ -12,9 +12,16 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "8386761d09819b665b6a6e1e6d6ff884bc8ff781", - "internalRef": "300843960", - "log": "8386761d09819b665b6a6e1e6d6ff884bc8ff781\nfeat: chromeos/modlab publish protos and config for Chrome OS Moblab API.\n\nPiperOrigin-RevId: 300843960\n\nb2e2bc62fab90e6829e62d3d189906d9b79899e4\nUpdates to GCS gRPC API spec:\n\n1. Changed GetIamPolicy and TestBucketIamPermissions to use wrapper messages around google.iam.v1 IAM requests messages, and added CommonRequestParams. This lets us support RequesterPays buckets.\n2. Added a metadata field to GetObjectMediaResponse, to support resuming an object media read safely (by extracting the generation of the object being read, and using it in the resumed read request).\n\nPiperOrigin-RevId: 300817706\n\n7fd916ce12335cc9e784bb9452a8602d00b2516c\nAdd deprecated_collections field for backward-compatiblity in PHP and monolith-generated Python and Ruby clients.\n\nGenerate TopicName class in Java which covers the functionality of both ProjectTopicName and DeletedTopicName. Introduce breaking changes to be fixed by synth.py.\n\nDelete default retry parameters.\n\nRetry codes defs can be deleted once # https://github.com/googleapis/gapic-generator/issues/3137 is fixed.\n\nPiperOrigin-RevId: 300813135\n\n047d3a8ac7f75383855df0166144f891d7af08d9\nfix!: google/rpc refactor ErrorInfo.type to ErrorInfo.reason and comment updates.\n\nPiperOrigin-RevId: 300773211\n\nfae4bb6d5aac52aabe5f0bb4396466c2304ea6f6\nAdding RetryPolicy to pubsub.proto\n\nPiperOrigin-RevId: 300769420\n\n7d569be2928dbd72b4e261bf9e468f23afd2b950\nAdding additional protocol buffer annotations to v3.\n\nPiperOrigin-RevId: 300718800\n\n13942d1a85a337515040a03c5108993087dc0e4f\nAdd logging protos for Recommender v1.\n\nPiperOrigin-RevId: 300689896\n\na1a573c3eecfe2c404892bfa61a32dd0c9fb22b6\nfix: change go package to use cloud.google.com/go/maps\n\nPiperOrigin-RevId: 300661825\n\nc6fbac11afa0c7ab2972d9df181493875c566f77\nfeat: publish documentai/v1beta2 protos\n\nPiperOrigin-RevId: 300656808\n\n5202a9e0d9903f49e900f20fe5c7f4e42dd6588f\nProtos for v1beta1 release of Cloud Security Center Settings API\n\nPiperOrigin-RevId: 300580858\n\n83518e18655d9d4ac044acbda063cc6ecdb63ef8\nAdds gapic.yaml file and BUILD.bazel file.\n\nPiperOrigin-RevId: 300554200\n\n836c196dc8ef8354bbfb5f30696bd3477e8db5e2\nRegenerate recommender v1beta1 gRPC ServiceConfig file for Insights methods.\n\nPiperOrigin-RevId: 300549302\n\n34a5450c591b6be3d6566f25ac31caa5211b2f3f\nIncreases the default timeout from 20s to 30s for MetricService\n\nPiperOrigin-RevId: 300474272\n\n5d8bffe87cd01ba390c32f1714230e5a95d5991d\nfeat: use the latest gapic-generator in WORKSPACE for bazel build.\n\nPiperOrigin-RevId: 300461878\n\nd631c651e3bcfac5d371e8560c27648f7b3e2364\nUpdated the GAPIC configs to include parameters for Backups APIs.\n\nPiperOrigin-RevId: 300443402\n\n678afc7055c1adea9b7b54519f3bdb228013f918\nAdding Game Servers v1beta API.\n\nPiperOrigin-RevId: 300433218\n\n80d2bd2c652a5e213302041b0620aff423132589\nEnable proto annotation and gapic v2 for talent API.\n\nPiperOrigin-RevId: 300393997\n\n85e454be7a353f7fe1bf2b0affb753305785b872\ndocs(google/maps/roads): remove mention of nonexported api\n\nPiperOrigin-RevId: 300367734\n\nbf839ae632e0f263a729569e44be4b38b1c85f9c\nAdding protocol buffer annotations and updated config info for v1 and v2.\n\nPiperOrigin-RevId: 300276913\n\n309b899ca18a4c604bce63882a161d44854da549\nPublish `Backup` APIs and protos.\n\nPiperOrigin-RevId: 300246038\n\neced64c3f122421350b4aca68a28e89121d20db8\nadd PHP client libraries\n\nPiperOrigin-RevId: 300193634\n\n7727af0e39df1ae9ad715895c8576d7b65cf6c6d\nfeat: use the latest gapic-generator and protoc-java-resource-name-plugin in googleapis/WORKSPACE.\n\nPiperOrigin-RevId: 300188410\n\n2a25aa351dd5b5fe14895266aff5824d90ce757b\nBreaking change: remove the ProjectOrTenant resource and its references.\n\nPiperOrigin-RevId: 300182152\n\na499dbb28546379415f51803505cfb6123477e71\nUpdate web risk v1 gapic config and BUILD file.\n\nPiperOrigin-RevId: 300152177\n\n52701da10fec2a5f9796e8d12518c0fe574488fe\nFix: apply appropriate namespace/package options for C#, PHP and Ruby.\n\nPiperOrigin-RevId: 300123508\n\n365c029b8cdb63f7751b92ab490f1976e616105c\nAdd CC targets to the kms protos.\n\nThese are needed by go/tink.\n\nPiperOrigin-RevId: 300038469\n\n4ba9aa8a4a1413b88dca5a8fa931824ee9c284e6\nExpose logo recognition API proto for GA.\n\nPiperOrigin-RevId: 299971671\n\n1c9fc2c9e03dadf15f16b1c4f570955bdcebe00e\nAdding ruby_package option to accessapproval.proto for the Ruby client libraries generation.\n\nPiperOrigin-RevId: 299955924\n\n1cc6f0a7bfb147e6f2ede911d9b01e7a9923b719\nbuild(google/maps/routes): generate api clients\n\nPiperOrigin-RevId: 299955905\n\n29a47c965aac79e3fe8e3314482ca0b5967680f0\nIncrease timeout to 1hr for method `dropRange` in bigtable/admin/v2, which is\nsynced with the timeout setting in gapic_yaml.\n\nPiperOrigin-RevId: 299917154\n\n8f631c4c70a60a9c7da3749511ee4ad432b62898\nbuild(google/maps/roads/v1op): move go to monorepo pattern\n\nPiperOrigin-RevId: 299885195\n\nd66816518844ebbf63504c9e8dfc7133921dd2cd\nbuild(google/maps/roads/v1op): Add bazel build files to generate clients.\n\nPiperOrigin-RevId: 299851148\n\naf7dff701fabe029672168649c62356cf1bb43d0\nAdd LogPlayerReports and LogImpressions to Playable Locations service\n\nPiperOrigin-RevId: 299724050\n\nb6927fca808f38df32a642c560082f5bf6538ced\nUpdate BigQuery Connection API v1beta1 proto: added credential to CloudSqlProperties.\n\nPiperOrigin-RevId: 299503150\n\n91e1fb5ef9829c0c7a64bfa5bde330e6ed594378\nchore: update protobuf (protoc) version to 3.11.2\n\nPiperOrigin-RevId: 299404145\n\n30e36b4bee6749c4799f4fc1a51cc8f058ba167d\nUpdate cloud asset api v1p4beta1.\n\nPiperOrigin-RevId: 299399890\n\nffbb493674099f265693872ae250711b2238090c\nfeat: cloudbuild/v1 add new fields and annotate OUTPUT_OUT fields.\n\nPiperOrigin-RevId: 299397780\n\nbc973a15818e00c19e121959832676e9b7607456\nbazel: Fix broken common dependency\n\nPiperOrigin-RevId: 299397431\n\n71094a343e3b962e744aa49eb9338219537474e4\nchore: bigtable/admin/v2 publish retry config\n\nPiperOrigin-RevId: 299391875\n\n8f488efd7bda33885cb674ddd023b3678c40bd82\nfeat: Migrate logging to GAPIC v2; release new features.\n\nIMPORTANT: This is a breaking change for client libraries\nin all languages.\n\nCommitter: @lukesneeringer, @jskeet\nPiperOrigin-RevId: 299370279\n\n007605bf9ad3a1fd775014ebefbf7f1e6b31ee71\nUpdate API for bigqueryreservation v1beta1.\n- Adds flex capacity commitment plan to CapacityCommitment.\n- Adds methods for getting and updating BiReservations.\n- Adds methods for updating/splitting/merging CapacityCommitments.\n\nPiperOrigin-RevId: 299368059\n\nf0b581b5bdf803e45201ecdb3688b60e381628a8\nfix: recommendationengine/v1beta1 update some comments\n\nPiperOrigin-RevId: 299181282\n\n10e9a0a833dc85ff8f05b2c67ebe5ac785fe04ff\nbuild: add generated BUILD file for Routes Preferred API\n\nPiperOrigin-RevId: 299164808\n\n86738c956a8238d7c77f729be78b0ed887a6c913\npublish v1p1beta1: update with absolute address in comments\n\nPiperOrigin-RevId: 299152383\n\n73d9f2ad4591de45c2e1f352bc99d70cbd2a6d95\npublish v1: update with absolute address in comments\n\nPiperOrigin-RevId: 299147194\n\nd2158f24cb77b0b0ccfe68af784c6a628705e3c6\npublish v1beta2: update with absolute address in comments\n\nPiperOrigin-RevId: 299147086\n\n7fca61292c11b4cd5b352cee1a50bf88819dd63b\npublish v1p2beta1: update with absolute address in comments\n\nPiperOrigin-RevId: 299146903\n\n583b7321624736e2c490e328f4b1957335779295\npublish v1p3beta1: update with absolute address in comments\n\nPiperOrigin-RevId: 299146674\n\n638253bf86d1ce1c314108a089b7351440c2f0bf\nfix: add java_multiple_files option for automl text_sentiment.proto\n\nPiperOrigin-RevId: 298971070\n\n373d655703bf914fb8b0b1cc4071d772bac0e0d1\nUpdate Recs AI Beta public bazel file\n\nPiperOrigin-RevId: 298961623\n\ndcc5d00fc8a8d8b56f16194d7c682027b2c66a3b\nfix: add java_multiple_files option for automl classification.proto\n\nPiperOrigin-RevId: 298953301\n\na3f791827266f3496a6a5201d58adc4bb265c2a3\nchore: automl/v1 publish annotations and retry config\n\nPiperOrigin-RevId: 298942178\n\n01c681586d8d6dbd60155289b587aee678530bd9\nMark return_immediately in PullRequest deprecated.\n\nPiperOrigin-RevId: 298893281\n\nc9f5e9c4bfed54bbd09227e990e7bded5f90f31c\nRemove out of date documentation for predicate support on the Storage API\n\nPiperOrigin-RevId: 298883309\n\nfd5b3b8238d783b04692a113ffe07c0363f5de0f\ngenerate webrisk v1 proto\n\nPiperOrigin-RevId: 298847934\n\n541b1ded4abadcc38e8178680b0677f65594ea6f\nUpdate cloud asset api v1p4beta1.\n\nPiperOrigin-RevId: 298686266\n\nc0d171acecb4f5b0bfd2c4ca34fc54716574e300\n Updated to include the Notification v1 API.\n\nPiperOrigin-RevId: 298652775\n\n2346a9186c0bff2c9cc439f2459d558068637e05\nAdd Service Directory v1beta1 protos and configs\n\nPiperOrigin-RevId: 298625638\n\na78ed801b82a5c6d9c5368e24b1412212e541bb7\nPublishing v3 protos and configs.\n\nPiperOrigin-RevId: 298607357\n\n4a180bfff8a21645b3a935c2756e8d6ab18a74e0\nautoml/v1beta1 publish proto updates\n\nPiperOrigin-RevId: 298484782\n\n6de6e938b7df1cd62396563a067334abeedb9676\nchore: use the latest gapic-generator and protoc-java-resource-name-plugin in Bazel workspace.\n\nPiperOrigin-RevId: 298474513\n\n244ab2b83a82076a1fa7be63b7e0671af73f5c02\nAdds service config definition for bigqueryreservation v1\n\nPiperOrigin-RevId: 298455048\n\n83c6f84035ee0f80eaa44d8b688a010461cc4080\nUpdate google/api/auth.proto to make AuthProvider to have JwtLocation\n\nPiperOrigin-RevId: 297918498\n\n" + "sha": "ae78682c05e864d71223ce22532219813b0245ac", + "internalRef": "301185150" + } + }, + { + "git": { + "name": "googleapis", + "remote": "https://github.com/googleapis/googleapis.git", + "sha": "ae78682c05e864d71223ce22532219813b0245ac", + "internalRef": "301185150" } }, { @@ -35,6 +42,15 @@ "generator": "gapic", "config": "google/cloud/webrisk/artman_webrisk_v1beta1.yaml" } + }, + { + "client": { + "source": "googleapis", + "apiName": "webrisk", + "apiVersion": "v1", + "language": "java", + "generator": "bazel" + } } ] } \ No newline at end of file diff --git a/synth.py b/synth.py index d37b6bc0..eeefbec1 100644 --- a/synth.py +++ b/synth.py @@ -14,7 +14,6 @@ """This script is used to synthesize generated parts of this library.""" -import synthtool as s import synthtool.gcp as gcp import synthtool.languages.java as java @@ -34,4 +33,9 @@ gapic=gapic, ) +java.bazel_library( + service=service, + version='v1', +) + java.common_templates()