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
index 7333e64c..b3252f81 100644
--- 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
@@ -105,6 +105,20 @@
* WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create(webRiskServiceSettings);
* }
*
+ * To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
+ * the wire:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * WebRiskServiceSettings webRiskServiceSettings =
+ * WebRiskServiceSettings.newBuilder()
+ * .setTransportChannelProvider(
+ * WebRiskServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
+ * .build();
+ * WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create(webRiskServiceSettings);
+ * }
+ *
* Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@Generated("by gapic-generator-java")
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
index 128377e9..550627b9 100644
--- 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
@@ -21,6 +21,7 @@
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.httpjson.InstantiatingHttpJsonChannelProvider;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.ClientSettings;
@@ -122,11 +123,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
return WebRiskServiceStubSettings.defaultCredentialsProviderBuilder();
}
- /** Returns a builder for the default ChannelProvider for this service. */
+ /** Returns a builder for the default gRPC ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return WebRiskServiceStubSettings.defaultGrpcTransportProviderBuilder();
}
+ /** Returns a builder for the default REST ChannelProvider for this service. */
+ @BetaApi
+ public static InstantiatingHttpJsonChannelProvider.Builder
+ defaultHttpJsonTransportProviderBuilder() {
+ return WebRiskServiceStubSettings.defaultHttpJsonTransportProviderBuilder();
+ }
+
public static TransportChannelProvider defaultTransportChannelProvider() {
return WebRiskServiceStubSettings.defaultTransportChannelProvider();
}
@@ -136,11 +144,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
return WebRiskServiceStubSettings.defaultApiClientHeaderProviderBuilder();
}
- /** Returns a new builder for this class. */
+ /** Returns a new gRPC builder for this class. */
public static Builder newBuilder() {
return Builder.createDefault();
}
+ /** Returns a new REST builder for this class. */
+ @BetaApi
+ public static Builder newHttpJsonBuilder() {
+ return Builder.createHttpJsonDefault();
+ }
+
/** Returns a new builder for this class. */
public static Builder newBuilder(ClientContext clientContext) {
return new Builder(clientContext);
@@ -178,6 +192,11 @@ private static Builder createDefault() {
return new Builder(WebRiskServiceStubSettings.newBuilder());
}
+ @BetaApi
+ private static Builder createHttpJsonDefault() {
+ return new Builder(WebRiskServiceStubSettings.newHttpJsonBuilder());
+ }
+
public WebRiskServiceStubSettings.Builder getStubSettingsBuilder() {
return ((WebRiskServiceStubSettings.Builder) getStubSettings());
}
diff --git a/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/HttpJsonWebRiskServiceCallableFactory.java b/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/HttpJsonWebRiskServiceCallableFactory.java
new file mode 100644
index 00000000..948609c5
--- /dev/null
+++ b/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/HttpJsonWebRiskServiceCallableFactory.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1.stub;
+
+import com.google.api.core.BetaApi;
+import com.google.api.gax.httpjson.HttpJsonCallSettings;
+import com.google.api.gax.httpjson.HttpJsonCallableFactory;
+import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable;
+import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
+import com.google.api.gax.httpjson.longrunning.stub.OperationsStub;
+import com.google.api.gax.rpc.BatchingCallSettings;
+import com.google.api.gax.rpc.ClientContext;
+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.UnaryCallSettings;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.longrunning.Operation;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * REST callable factory implementation for the WebRiskService service API.
+ *
+ *
This class is for advanced usage.
+ */
+@Generated("by gapic-generator-java")
+@BetaApi
+public class HttpJsonWebRiskServiceCallableFactory
+ implements HttpJsonStubCallableFactory {
+
+ @Override
+ public UnaryCallable createUnaryCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ UnaryCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createUnaryCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public
+ UnaryCallable createPagedCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ PagedCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createPagedCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public UnaryCallable createBatchingCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ BatchingCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createBatchingCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ @Override
+ public
+ OperationCallable createOperationCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ OperationCallSettings callSettings,
+ ClientContext clientContext,
+ OperationsStub operationsStub) {
+ UnaryCallable innerCallable =
+ HttpJsonCallableFactory.createBaseUnaryCallable(
+ httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext);
+ HttpJsonOperationSnapshotCallable initialCallable =
+ new HttpJsonOperationSnapshotCallable(
+ innerCallable,
+ httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory());
+ return HttpJsonCallableFactory.createOperationCallable(
+ callSettings, clientContext, operationsStub.longRunningClient(), initialCallable);
+ }
+
+ @Override
+ public
+ ServerStreamingCallable createServerStreamingCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ ServerStreamingCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createServerStreamingCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+}
diff --git a/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/HttpJsonWebRiskServiceStub.java b/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/HttpJsonWebRiskServiceStub.java
new file mode 100644
index 00000000..7f728bbc
--- /dev/null
+++ b/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/HttpJsonWebRiskServiceStub.java
@@ -0,0 +1,360 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1.stub;
+
+import com.google.api.core.BetaApi;
+import com.google.api.core.InternalApi;
+import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.core.BackgroundResourceAggregation;
+import com.google.api.gax.httpjson.ApiMethodDescriptor;
+import com.google.api.gax.httpjson.HttpJsonCallSettings;
+import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
+import com.google.api.gax.httpjson.ProtoMessageRequestFormatter;
+import com.google.api.gax.httpjson.ProtoMessageResponseParser;
+import com.google.api.gax.httpjson.ProtoRestSerializer;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.protobuf.TypeRegistry;
+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.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * REST stub implementation for the WebRiskService service API.
+ *
+ * This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+@BetaApi
+public class HttpJsonWebRiskServiceStub extends WebRiskServiceStub {
+ private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build();
+
+ private static final ApiMethodDescriptor<
+ ComputeThreatListDiffRequest, ComputeThreatListDiffResponse>
+ computeThreatListDiffMethodDescriptor =
+ ApiMethodDescriptor
+ .newBuilder()
+ .setFullMethodName("google.cloud.webrisk.v1.WebRiskService/ComputeThreatListDiff")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/threatLists:computeDiff",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(
+ fields, "constraints", request.getConstraints());
+ serializer.putQueryParam(fields, "threatType", request.getThreatType());
+ serializer.putQueryParam(
+ fields, "versionToken", request.getVersionToken());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(ComputeThreatListDiffResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ searchUrisMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.webrisk.v1.WebRiskService/SearchUris")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/uris:search",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(
+ fields, "threatTypes", request.getThreatTypesList());
+ serializer.putQueryParam(fields, "uri", request.getUri());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(SearchUrisResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ searchHashesMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.webrisk.v1.WebRiskService/SearchHashes")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/hashes:search",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "hashPrefix", request.getHashPrefix());
+ serializer.putQueryParam(
+ fields, "threatTypes", request.getThreatTypesList());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(SearchHashesResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ createSubmissionMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.webrisk.v1.WebRiskService/CreateSubmission")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=projects/*}/submissions",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "parent", request.getParent());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("submission", request.getSubmission()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Submission.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private final UnaryCallable
+ computeThreatListDiffCallable;
+ private final UnaryCallable searchUrisCallable;
+ private final UnaryCallable searchHashesCallable;
+ private final UnaryCallable createSubmissionCallable;
+
+ private final BackgroundResource backgroundResources;
+ private final HttpJsonStubCallableFactory callableFactory;
+
+ public static final HttpJsonWebRiskServiceStub create(WebRiskServiceStubSettings settings)
+ throws IOException {
+ return new HttpJsonWebRiskServiceStub(settings, ClientContext.create(settings));
+ }
+
+ public static final HttpJsonWebRiskServiceStub create(ClientContext clientContext)
+ throws IOException {
+ return new HttpJsonWebRiskServiceStub(
+ WebRiskServiceStubSettings.newHttpJsonBuilder().build(), clientContext);
+ }
+
+ public static final HttpJsonWebRiskServiceStub create(
+ ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException {
+ return new HttpJsonWebRiskServiceStub(
+ WebRiskServiceStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory);
+ }
+
+ /**
+ * Constructs an instance of HttpJsonWebRiskServiceStub, 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 HttpJsonWebRiskServiceStub(
+ WebRiskServiceStubSettings settings, ClientContext clientContext) throws IOException {
+ this(settings, clientContext, new HttpJsonWebRiskServiceCallableFactory());
+ }
+
+ /**
+ * Constructs an instance of HttpJsonWebRiskServiceStub, 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 HttpJsonWebRiskServiceStub(
+ WebRiskServiceStubSettings settings,
+ ClientContext clientContext,
+ HttpJsonStubCallableFactory callableFactory)
+ throws IOException {
+ this.callableFactory = callableFactory;
+
+ HttpJsonCallSettings
+ computeThreatListDiffTransportSettings =
+ HttpJsonCallSettings
+ .newBuilder()
+ .setMethodDescriptor(computeThreatListDiffMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings searchUrisTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(searchUrisMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings searchHashesTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(searchHashesMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings createSubmissionTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(createSubmissionMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .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);
+
+ this.backgroundResources =
+ new BackgroundResourceAggregation(clientContext.getBackgroundResources());
+ }
+
+ @InternalApi
+ public static List getMethodDescriptors() {
+ List methodDescriptors = new ArrayList<>();
+ methodDescriptors.add(computeThreatListDiffMethodDescriptor);
+ methodDescriptors.add(searchUrisMethodDescriptor);
+ methodDescriptors.add(searchHashesMethodDescriptor);
+ methodDescriptors.add(createSubmissionMethodDescriptor);
+ return methodDescriptors;
+ }
+
+ @Override
+ public UnaryCallable
+ computeThreatListDiffCallable() {
+ return computeThreatListDiffCallable;
+ }
+
+ @Override
+ public UnaryCallable searchUrisCallable() {
+ return searchUrisCallable;
+ }
+
+ @Override
+ public UnaryCallable searchHashesCallable() {
+ return searchHashesCallable;
+ }
+
+ @Override
+ public UnaryCallable createSubmissionCallable() {
+ return createSubmissionCallable;
+ }
+
+ @Override
+ public final void close() {
+ try {
+ backgroundResources.close();
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new IllegalStateException("Failed to close resource", e);
+ }
+ }
+
+ @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/WebRiskServiceStubSettings.java b/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1/stub/WebRiskServiceStubSettings.java
index fcd88d08..ffb044c5 100644
--- 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
@@ -24,6 +24,9 @@
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.httpjson.GaxHttpJsonProperties;
+import com.google.api.gax.httpjson.HttpJsonTransportChannel;
+import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
import com.google.api.gax.retrying.RetrySettings;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.ClientContext;
@@ -121,6 +124,11 @@ public WebRiskServiceStub createStub() throws IOException {
.equals(GrpcTransportChannel.getGrpcTransportName())) {
return GrpcWebRiskServiceStub.create(this);
}
+ if (getTransportChannelProvider()
+ .getTransportName()
+ .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) {
+ return HttpJsonWebRiskServiceStub.create(this);
+ }
throw new UnsupportedOperationException(
String.format(
"Transport not supported: %s", getTransportChannelProvider().getTransportName()));
@@ -153,18 +161,25 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
.setUseJwtAccessWithScope(true);
}
- /** Returns a builder for the default ChannelProvider for this service. */
+ /** Returns a builder for the default gRPC ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return InstantiatingGrpcChannelProvider.newBuilder()
.setMaxInboundMessageSize(Integer.MAX_VALUE);
}
+ /** Returns a builder for the default REST ChannelProvider for this service. */
+ @BetaApi
+ public static InstantiatingHttpJsonChannelProvider.Builder
+ defaultHttpJsonTransportProviderBuilder() {
+ return InstantiatingHttpJsonChannelProvider.newBuilder();
+ }
+
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() {
+ public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() {
return ApiClientHeaderProvider.newBuilder()
.setGeneratedLibToken(
"gapic", GaxProperties.getLibraryVersion(WebRiskServiceStubSettings.class))
@@ -172,11 +187,30 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion());
}
- /** Returns a new builder for this class. */
+ @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
+ public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() {
+ return ApiClientHeaderProvider.newBuilder()
+ .setGeneratedLibToken(
+ "gapic", GaxProperties.getLibraryVersion(WebRiskServiceStubSettings.class))
+ .setTransportToken(
+ GaxHttpJsonProperties.getHttpJsonTokenName(),
+ GaxHttpJsonProperties.getHttpJsonVersion());
+ }
+
+ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ return WebRiskServiceStubSettings.defaultGrpcApiClientHeaderProviderBuilder();
+ }
+
+ /** Returns a new gRPC builder for this class. */
public static Builder newBuilder() {
return Builder.createDefault();
}
+ /** Returns a new REST builder for this class. */
+ public static Builder newHttpJsonBuilder() {
+ return Builder.createHttpJsonDefault();
+ }
+
/** Returns a new builder for this class. */
public static Builder newBuilder(ClientContext clientContext) {
return new Builder(clientContext);
@@ -301,6 +335,19 @@ private static Builder createDefault() {
return initDefaults(builder);
}
+ private static Builder createHttpJsonDefault() {
+ Builder builder = new Builder(((ClientContext) null));
+
+ builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build());
+ builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
+ builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build());
+ builder.setEndpoint(getDefaultEndpoint());
+ builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
+ builder.setSwitchToMtlsEndpointAllowed(true);
+
+ return initDefaults(builder);
+ }
+
private static Builder initDefaults(Builder builder) {
builder
.computeThreatListDiffSettings()
diff --git a/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1beta1/WebRiskServiceV1Beta1Client.java b/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1beta1/WebRiskServiceV1Beta1Client.java
index 38a5d28a..51fd0d5e 100644
--- a/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1beta1/WebRiskServiceV1Beta1Client.java
+++ b/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1beta1/WebRiskServiceV1Beta1Client.java
@@ -107,6 +107,21 @@
* WebRiskServiceV1Beta1Client.create(webRiskServiceV1Beta1Settings);
* }
*
+ * To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
+ * the wire:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * WebRiskServiceV1Beta1Settings webRiskServiceV1Beta1Settings =
+ * WebRiskServiceV1Beta1Settings.newBuilder()
+ * .setTransportChannelProvider(
+ * WebRiskServiceV1Beta1Settings.defaultHttpJsonTransportProviderBuilder().build())
+ * .build();
+ * WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client =
+ * WebRiskServiceV1Beta1Client.create(webRiskServiceV1Beta1Settings);
+ * }
+ *
* Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@BetaApi
diff --git a/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1beta1/WebRiskServiceV1Beta1Settings.java b/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1beta1/WebRiskServiceV1Beta1Settings.java
index 695ddc73..c977d2c0 100644
--- a/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1beta1/WebRiskServiceV1Beta1Settings.java
+++ b/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1beta1/WebRiskServiceV1Beta1Settings.java
@@ -21,6 +21,7 @@
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.httpjson.InstantiatingHttpJsonChannelProvider;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.ClientSettings;
@@ -117,11 +118,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
return WebRiskServiceV1Beta1StubSettings.defaultCredentialsProviderBuilder();
}
- /** Returns a builder for the default ChannelProvider for this service. */
+ /** Returns a builder for the default gRPC ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return WebRiskServiceV1Beta1StubSettings.defaultGrpcTransportProviderBuilder();
}
+ /** Returns a builder for the default REST ChannelProvider for this service. */
+ @BetaApi
+ public static InstantiatingHttpJsonChannelProvider.Builder
+ defaultHttpJsonTransportProviderBuilder() {
+ return WebRiskServiceV1Beta1StubSettings.defaultHttpJsonTransportProviderBuilder();
+ }
+
public static TransportChannelProvider defaultTransportChannelProvider() {
return WebRiskServiceV1Beta1StubSettings.defaultTransportChannelProvider();
}
@@ -131,11 +139,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
return WebRiskServiceV1Beta1StubSettings.defaultApiClientHeaderProviderBuilder();
}
- /** Returns a new builder for this class. */
+ /** Returns a new gRPC builder for this class. */
public static Builder newBuilder() {
return Builder.createDefault();
}
+ /** Returns a new REST builder for this class. */
+ @BetaApi
+ public static Builder newHttpJsonBuilder() {
+ return Builder.createHttpJsonDefault();
+ }
+
/** Returns a new builder for this class. */
public static Builder newBuilder(ClientContext clientContext) {
return new Builder(clientContext);
@@ -174,6 +188,11 @@ private static Builder createDefault() {
return new Builder(WebRiskServiceV1Beta1StubSettings.newBuilder());
}
+ @BetaApi
+ private static Builder createHttpJsonDefault() {
+ return new Builder(WebRiskServiceV1Beta1StubSettings.newHttpJsonBuilder());
+ }
+
public WebRiskServiceV1Beta1StubSettings.Builder getStubSettingsBuilder() {
return ((WebRiskServiceV1Beta1StubSettings.Builder) getStubSettings());
}
diff --git a/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1beta1/stub/HttpJsonWebRiskServiceV1Beta1CallableFactory.java b/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1beta1/stub/HttpJsonWebRiskServiceV1Beta1CallableFactory.java
new file mode 100644
index 00000000..153c9361
--- /dev/null
+++ b/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1beta1/stub/HttpJsonWebRiskServiceV1Beta1CallableFactory.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1beta1.stub;
+
+import com.google.api.core.BetaApi;
+import com.google.api.gax.httpjson.HttpJsonCallSettings;
+import com.google.api.gax.httpjson.HttpJsonCallableFactory;
+import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable;
+import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
+import com.google.api.gax.httpjson.longrunning.stub.OperationsStub;
+import com.google.api.gax.rpc.BatchingCallSettings;
+import com.google.api.gax.rpc.ClientContext;
+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.UnaryCallSettings;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.longrunning.Operation;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * REST callable factory implementation for the WebRiskServiceV1Beta1 service API.
+ *
+ *
This class is for advanced usage.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class HttpJsonWebRiskServiceV1Beta1CallableFactory
+ implements HttpJsonStubCallableFactory {
+
+ @Override
+ public UnaryCallable createUnaryCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ UnaryCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createUnaryCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public
+ UnaryCallable createPagedCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ PagedCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createPagedCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public UnaryCallable createBatchingCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ BatchingCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createBatchingCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ @Override
+ public
+ OperationCallable createOperationCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ OperationCallSettings callSettings,
+ ClientContext clientContext,
+ OperationsStub operationsStub) {
+ UnaryCallable innerCallable =
+ HttpJsonCallableFactory.createBaseUnaryCallable(
+ httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext);
+ HttpJsonOperationSnapshotCallable initialCallable =
+ new HttpJsonOperationSnapshotCallable(
+ innerCallable,
+ httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory());
+ return HttpJsonCallableFactory.createOperationCallable(
+ callSettings, clientContext, operationsStub.longRunningClient(), initialCallable);
+ }
+
+ @Override
+ public
+ ServerStreamingCallable createServerStreamingCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ ServerStreamingCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createServerStreamingCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+}
diff --git a/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1beta1/stub/HttpJsonWebRiskServiceV1Beta1Stub.java b/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1beta1/stub/HttpJsonWebRiskServiceV1Beta1Stub.java
new file mode 100644
index 00000000..e9667fd4
--- /dev/null
+++ b/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1beta1/stub/HttpJsonWebRiskServiceV1Beta1Stub.java
@@ -0,0 +1,310 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1beta1.stub;
+
+import com.google.api.core.BetaApi;
+import com.google.api.core.InternalApi;
+import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.core.BackgroundResourceAggregation;
+import com.google.api.gax.httpjson.ApiMethodDescriptor;
+import com.google.api.gax.httpjson.HttpJsonCallSettings;
+import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
+import com.google.api.gax.httpjson.ProtoMessageRequestFormatter;
+import com.google.api.gax.httpjson.ProtoMessageResponseParser;
+import com.google.api.gax.httpjson.ProtoRestSerializer;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.protobuf.TypeRegistry;
+import com.google.webrisk.v1beta1.ComputeThreatListDiffRequest;
+import com.google.webrisk.v1beta1.ComputeThreatListDiffResponse;
+import com.google.webrisk.v1beta1.SearchHashesRequest;
+import com.google.webrisk.v1beta1.SearchHashesResponse;
+import com.google.webrisk.v1beta1.SearchUrisRequest;
+import com.google.webrisk.v1beta1.SearchUrisResponse;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * REST stub implementation for the WebRiskServiceV1Beta1 service API.
+ *
+ * This class is for advanced usage and reflects the underlying API directly.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class HttpJsonWebRiskServiceV1Beta1Stub extends WebRiskServiceV1Beta1Stub {
+ private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build();
+
+ private static final ApiMethodDescriptor<
+ ComputeThreatListDiffRequest, ComputeThreatListDiffResponse>
+ computeThreatListDiffMethodDescriptor =
+ ApiMethodDescriptor
+ .newBuilder()
+ .setFullMethodName(
+ "google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1/ComputeThreatListDiff")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1beta1/threatLists:computeDiff",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(
+ fields, "constraints", request.getConstraints());
+ serializer.putQueryParam(fields, "threatType", request.getThreatType());
+ serializer.putQueryParam(
+ fields, "versionToken", request.getVersionToken());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(ComputeThreatListDiffResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ searchUrisMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1/SearchUris")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1beta1/uris:search",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(
+ fields, "threatTypes", request.getThreatTypesList());
+ serializer.putQueryParam(fields, "uri", request.getUri());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(SearchUrisResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ searchHashesMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1/SearchHashes")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1beta1/hashes:search",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "hashPrefix", request.getHashPrefix());
+ serializer.putQueryParam(
+ fields, "threatTypes", request.getThreatTypesList());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(SearchHashesResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private final UnaryCallable
+ computeThreatListDiffCallable;
+ private final UnaryCallable searchUrisCallable;
+ private final UnaryCallable searchHashesCallable;
+
+ private final BackgroundResource backgroundResources;
+ private final HttpJsonStubCallableFactory callableFactory;
+
+ public static final HttpJsonWebRiskServiceV1Beta1Stub create(
+ WebRiskServiceV1Beta1StubSettings settings) throws IOException {
+ return new HttpJsonWebRiskServiceV1Beta1Stub(settings, ClientContext.create(settings));
+ }
+
+ public static final HttpJsonWebRiskServiceV1Beta1Stub create(ClientContext clientContext)
+ throws IOException {
+ return new HttpJsonWebRiskServiceV1Beta1Stub(
+ WebRiskServiceV1Beta1StubSettings.newHttpJsonBuilder().build(), clientContext);
+ }
+
+ public static final HttpJsonWebRiskServiceV1Beta1Stub create(
+ ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException {
+ return new HttpJsonWebRiskServiceV1Beta1Stub(
+ WebRiskServiceV1Beta1StubSettings.newHttpJsonBuilder().build(),
+ clientContext,
+ callableFactory);
+ }
+
+ /**
+ * Constructs an instance of HttpJsonWebRiskServiceV1Beta1Stub, 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 HttpJsonWebRiskServiceV1Beta1Stub(
+ WebRiskServiceV1Beta1StubSettings settings, ClientContext clientContext) throws IOException {
+ this(settings, clientContext, new HttpJsonWebRiskServiceV1Beta1CallableFactory());
+ }
+
+ /**
+ * Constructs an instance of HttpJsonWebRiskServiceV1Beta1Stub, 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 HttpJsonWebRiskServiceV1Beta1Stub(
+ WebRiskServiceV1Beta1StubSettings settings,
+ ClientContext clientContext,
+ HttpJsonStubCallableFactory callableFactory)
+ throws IOException {
+ this.callableFactory = callableFactory;
+
+ HttpJsonCallSettings
+ computeThreatListDiffTransportSettings =
+ HttpJsonCallSettings
+ .newBuilder()
+ .setMethodDescriptor(computeThreatListDiffMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings searchUrisTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(searchUrisMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings searchHashesTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(searchHashesMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .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.backgroundResources =
+ new BackgroundResourceAggregation(clientContext.getBackgroundResources());
+ }
+
+ @InternalApi
+ public static List getMethodDescriptors() {
+ List methodDescriptors = new ArrayList<>();
+ methodDescriptors.add(computeThreatListDiffMethodDescriptor);
+ methodDescriptors.add(searchUrisMethodDescriptor);
+ methodDescriptors.add(searchHashesMethodDescriptor);
+ return methodDescriptors;
+ }
+
+ @Override
+ public UnaryCallable
+ computeThreatListDiffCallable() {
+ return computeThreatListDiffCallable;
+ }
+
+ @Override
+ public UnaryCallable searchUrisCallable() {
+ return searchUrisCallable;
+ }
+
+ @Override
+ public UnaryCallable searchHashesCallable() {
+ return searchHashesCallable;
+ }
+
+ @Override
+ public final void close() {
+ try {
+ backgroundResources.close();
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new IllegalStateException("Failed to close resource", e);
+ }
+ }
+
+ @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/v1beta1/stub/WebRiskServiceV1Beta1StubSettings.java b/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1beta1/stub/WebRiskServiceV1Beta1StubSettings.java
index 2367714d..0331b0e8 100644
--- a/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1beta1/stub/WebRiskServiceV1Beta1StubSettings.java
+++ b/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1beta1/stub/WebRiskServiceV1Beta1StubSettings.java
@@ -24,6 +24,9 @@
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.httpjson.GaxHttpJsonProperties;
+import com.google.api.gax.httpjson.HttpJsonTransportChannel;
+import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
import com.google.api.gax.retrying.RetrySettings;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.ClientContext;
@@ -116,6 +119,11 @@ public WebRiskServiceV1Beta1Stub createStub() throws IOException {
.equals(GrpcTransportChannel.getGrpcTransportName())) {
return GrpcWebRiskServiceV1Beta1Stub.create(this);
}
+ if (getTransportChannelProvider()
+ .getTransportName()
+ .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) {
+ return HttpJsonWebRiskServiceV1Beta1Stub.create(this);
+ }
throw new UnsupportedOperationException(
String.format(
"Transport not supported: %s", getTransportChannelProvider().getTransportName()));
@@ -148,18 +156,25 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
.setUseJwtAccessWithScope(true);
}
- /** Returns a builder for the default ChannelProvider for this service. */
+ /** Returns a builder for the default gRPC ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return InstantiatingGrpcChannelProvider.newBuilder()
.setMaxInboundMessageSize(Integer.MAX_VALUE);
}
+ /** Returns a builder for the default REST ChannelProvider for this service. */
+ @BetaApi
+ public static InstantiatingHttpJsonChannelProvider.Builder
+ defaultHttpJsonTransportProviderBuilder() {
+ return InstantiatingHttpJsonChannelProvider.newBuilder();
+ }
+
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() {
+ public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() {
return ApiClientHeaderProvider.newBuilder()
.setGeneratedLibToken(
"gapic", GaxProperties.getLibraryVersion(WebRiskServiceV1Beta1StubSettings.class))
@@ -167,11 +182,30 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion());
}
- /** Returns a new builder for this class. */
+ @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
+ public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() {
+ return ApiClientHeaderProvider.newBuilder()
+ .setGeneratedLibToken(
+ "gapic", GaxProperties.getLibraryVersion(WebRiskServiceV1Beta1StubSettings.class))
+ .setTransportToken(
+ GaxHttpJsonProperties.getHttpJsonTokenName(),
+ GaxHttpJsonProperties.getHttpJsonVersion());
+ }
+
+ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ return WebRiskServiceV1Beta1StubSettings.defaultGrpcApiClientHeaderProviderBuilder();
+ }
+
+ /** Returns a new gRPC builder for this class. */
public static Builder newBuilder() {
return Builder.createDefault();
}
+ /** Returns a new REST builder for this class. */
+ public static Builder newHttpJsonBuilder() {
+ return Builder.createHttpJsonDefault();
+ }
+
/** Returns a new builder for this class. */
public static Builder newBuilder(ClientContext clientContext) {
return new Builder(clientContext);
@@ -276,6 +310,19 @@ private static Builder createDefault() {
return initDefaults(builder);
}
+ private static Builder createHttpJsonDefault() {
+ Builder builder = new Builder(((ClientContext) null));
+
+ builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build());
+ builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
+ builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build());
+ builder.setEndpoint(getDefaultEndpoint());
+ builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
+ builder.setSwitchToMtlsEndpointAllowed(true);
+
+ return initDefaults(builder);
+ }
+
private static Builder initDefaults(Builder builder) {
builder
.computeThreatListDiffSettings()
diff --git a/google-cloud-webrisk/src/test/java/com/google/cloud/webrisk/v1/WebRiskServiceClientHttpJsonTest.java b/google-cloud-webrisk/src/test/java/com/google/cloud/webrisk/v1/WebRiskServiceClientHttpJsonTest.java
new file mode 100644
index 00000000..507f3bcd
--- /dev/null
+++ b/google-cloud-webrisk/src/test/java/com/google/cloud/webrisk/v1/WebRiskServiceClientHttpJsonTest.java
@@ -0,0 +1,319 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1;
+
+import com.google.api.gax.core.NoCredentialsProvider;
+import com.google.api.gax.httpjson.GaxHttpJsonProperties;
+import com.google.api.gax.httpjson.testing.MockHttpService;
+import com.google.api.gax.rpc.ApiClientHeaderProvider;
+import com.google.api.gax.rpc.ApiException;
+import com.google.api.gax.rpc.ApiExceptionFactory;
+import com.google.api.gax.rpc.InvalidArgumentException;
+import com.google.api.gax.rpc.StatusCode;
+import com.google.api.gax.rpc.testing.FakeStatusCode;
+import com.google.cloud.webrisk.v1.stub.HttpJsonWebRiskServiceStub;
+import com.google.protobuf.ByteString;
+import com.google.protobuf.Timestamp;
+import com.google.webrisk.v1.ComputeThreatListDiffRequest;
+import com.google.webrisk.v1.ComputeThreatListDiffResponse;
+import com.google.webrisk.v1.ProjectName;
+import com.google.webrisk.v1.SearchHashesResponse;
+import com.google.webrisk.v1.SearchUrisResponse;
+import com.google.webrisk.v1.Submission;
+import com.google.webrisk.v1.ThreatEntryAdditions;
+import com.google.webrisk.v1.ThreatEntryRemovals;
+import com.google.webrisk.v1.ThreatType;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import javax.annotation.Generated;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+@Generated("by gapic-generator-java")
+public class WebRiskServiceClientHttpJsonTest {
+ private static MockHttpService mockService;
+ private static WebRiskServiceClient client;
+
+ @BeforeClass
+ public static void startStaticServer() throws IOException {
+ mockService =
+ new MockHttpService(
+ HttpJsonWebRiskServiceStub.getMethodDescriptors(),
+ WebRiskServiceSettings.getDefaultEndpoint());
+ WebRiskServiceSettings settings =
+ WebRiskServiceSettings.newHttpJsonBuilder()
+ .setTransportChannelProvider(
+ WebRiskServiceSettings.defaultHttpJsonTransportProviderBuilder()
+ .setHttpTransport(mockService)
+ .build())
+ .setCredentialsProvider(NoCredentialsProvider.create())
+ .build();
+ client = WebRiskServiceClient.create(settings);
+ }
+
+ @AfterClass
+ public static void stopServer() {
+ client.close();
+ }
+
+ @Before
+ public void setUp() {}
+
+ @After
+ public void tearDown() throws Exception {
+ mockService.reset();
+ }
+
+ @Test
+ public void computeThreatListDiffTest() throws Exception {
+ ComputeThreatListDiffResponse expectedResponse =
+ ComputeThreatListDiffResponse.newBuilder()
+ .setAdditions(ThreatEntryAdditions.newBuilder().build())
+ .setRemovals(ThreatEntryRemovals.newBuilder().build())
+ .setNewVersionToken(ByteString.EMPTY)
+ .setChecksum(ComputeThreatListDiffResponse.Checksum.newBuilder().build())
+ .setRecommendedNextDiff(Timestamp.newBuilder().build())
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ ThreatType threatType = ThreatType.forNumber(0);
+ ByteString versionToken = ByteString.EMPTY;
+ ComputeThreatListDiffRequest.Constraints constraints =
+ ComputeThreatListDiffRequest.Constraints.newBuilder().build();
+
+ ComputeThreatListDiffResponse actualResponse =
+ client.computeThreatListDiff(threatType, versionToken, constraints);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void computeThreatListDiffExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ ThreatType threatType = ThreatType.forNumber(0);
+ ByteString versionToken = ByteString.EMPTY;
+ ComputeThreatListDiffRequest.Constraints constraints =
+ ComputeThreatListDiffRequest.Constraints.newBuilder().build();
+ client.computeThreatListDiff(threatType, versionToken, constraints);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void searchUrisTest() throws Exception {
+ SearchUrisResponse expectedResponse =
+ SearchUrisResponse.newBuilder()
+ .setThreat(SearchUrisResponse.ThreatUri.newBuilder().build())
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ String uri = "uri116076";
+ List threatTypes = new ArrayList<>();
+
+ SearchUrisResponse actualResponse = client.searchUris(uri, threatTypes);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void searchUrisExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.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
+ public void searchHashesTest() throws Exception {
+ SearchHashesResponse expectedResponse =
+ SearchHashesResponse.newBuilder()
+ .addAllThreats(new ArrayList())
+ .setNegativeExpireTime(Timestamp.newBuilder().build())
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ ByteString hashPrefix = ByteString.EMPTY;
+ List threatTypes = new ArrayList<>();
+
+ SearchHashesResponse actualResponse = client.searchHashes(hashPrefix, threatTypes);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void searchHashesExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ ByteString hashPrefix = ByteString.EMPTY;
+ List threatTypes = new ArrayList<>();
+ client.searchHashes(hashPrefix, threatTypes);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void createSubmissionTest() throws Exception {
+ Submission expectedResponse = Submission.newBuilder().setUri("uri116076").build();
+ mockService.addResponse(expectedResponse);
+
+ ProjectName parent = ProjectName.of("[PROJECT]");
+ Submission submission = Submission.newBuilder().build();
+
+ Submission actualResponse = client.createSubmission(parent, submission);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void createSubmissionExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.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.
+ }
+ }
+
+ @Test
+ public void createSubmissionTest2() throws Exception {
+ Submission expectedResponse = Submission.newBuilder().setUri("uri116076").build();
+ mockService.addResponse(expectedResponse);
+
+ String parent = "projects/project-2353";
+ Submission submission = Submission.newBuilder().build();
+
+ Submission actualResponse = client.createSubmission(parent, submission);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void createSubmissionExceptionTest2() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ String parent = "projects/project-2353";
+ Submission submission = Submission.newBuilder().build();
+ client.createSubmission(parent, submission);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+}
diff --git a/google-cloud-webrisk/src/test/java/com/google/cloud/webrisk/v1beta1/WebRiskServiceV1Beta1ClientHttpJsonTest.java b/google-cloud-webrisk/src/test/java/com/google/cloud/webrisk/v1beta1/WebRiskServiceV1Beta1ClientHttpJsonTest.java
new file mode 100644
index 00000000..0b908788
--- /dev/null
+++ b/google-cloud-webrisk/src/test/java/com/google/cloud/webrisk/v1beta1/WebRiskServiceV1Beta1ClientHttpJsonTest.java
@@ -0,0 +1,231 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1beta1;
+
+import com.google.api.gax.core.NoCredentialsProvider;
+import com.google.api.gax.httpjson.GaxHttpJsonProperties;
+import com.google.api.gax.httpjson.testing.MockHttpService;
+import com.google.api.gax.rpc.ApiClientHeaderProvider;
+import com.google.api.gax.rpc.ApiException;
+import com.google.api.gax.rpc.ApiExceptionFactory;
+import com.google.api.gax.rpc.InvalidArgumentException;
+import com.google.api.gax.rpc.StatusCode;
+import com.google.api.gax.rpc.testing.FakeStatusCode;
+import com.google.cloud.webrisk.v1beta1.stub.HttpJsonWebRiskServiceV1Beta1Stub;
+import com.google.protobuf.ByteString;
+import com.google.protobuf.Timestamp;
+import com.google.webrisk.v1beta1.ComputeThreatListDiffRequest;
+import com.google.webrisk.v1beta1.ComputeThreatListDiffResponse;
+import com.google.webrisk.v1beta1.SearchHashesResponse;
+import com.google.webrisk.v1beta1.SearchUrisResponse;
+import com.google.webrisk.v1beta1.ThreatEntryAdditions;
+import com.google.webrisk.v1beta1.ThreatEntryRemovals;
+import com.google.webrisk.v1beta1.ThreatType;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import javax.annotation.Generated;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+@Generated("by gapic-generator-java")
+public class WebRiskServiceV1Beta1ClientHttpJsonTest {
+ private static MockHttpService mockService;
+ private static WebRiskServiceV1Beta1Client client;
+
+ @BeforeClass
+ public static void startStaticServer() throws IOException {
+ mockService =
+ new MockHttpService(
+ HttpJsonWebRiskServiceV1Beta1Stub.getMethodDescriptors(),
+ WebRiskServiceV1Beta1Settings.getDefaultEndpoint());
+ WebRiskServiceV1Beta1Settings settings =
+ WebRiskServiceV1Beta1Settings.newHttpJsonBuilder()
+ .setTransportChannelProvider(
+ WebRiskServiceV1Beta1Settings.defaultHttpJsonTransportProviderBuilder()
+ .setHttpTransport(mockService)
+ .build())
+ .setCredentialsProvider(NoCredentialsProvider.create())
+ .build();
+ client = WebRiskServiceV1Beta1Client.create(settings);
+ }
+
+ @AfterClass
+ public static void stopServer() {
+ client.close();
+ }
+
+ @Before
+ public void setUp() {}
+
+ @After
+ public void tearDown() throws Exception {
+ mockService.reset();
+ }
+
+ @Test
+ public void computeThreatListDiffTest() throws Exception {
+ ComputeThreatListDiffResponse expectedResponse =
+ ComputeThreatListDiffResponse.newBuilder()
+ .setAdditions(ThreatEntryAdditions.newBuilder().build())
+ .setRemovals(ThreatEntryRemovals.newBuilder().build())
+ .setNewVersionToken(ByteString.EMPTY)
+ .setChecksum(ComputeThreatListDiffResponse.Checksum.newBuilder().build())
+ .setRecommendedNextDiff(Timestamp.newBuilder().build())
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ ThreatType threatType = ThreatType.forNumber(0);
+ ByteString versionToken = ByteString.EMPTY;
+ ComputeThreatListDiffRequest.Constraints constraints =
+ ComputeThreatListDiffRequest.Constraints.newBuilder().build();
+
+ ComputeThreatListDiffResponse actualResponse =
+ client.computeThreatListDiff(threatType, versionToken, constraints);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void computeThreatListDiffExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ ThreatType threatType = ThreatType.forNumber(0);
+ ByteString versionToken = ByteString.EMPTY;
+ ComputeThreatListDiffRequest.Constraints constraints =
+ ComputeThreatListDiffRequest.Constraints.newBuilder().build();
+ client.computeThreatListDiff(threatType, versionToken, constraints);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void searchUrisTest() throws Exception {
+ SearchUrisResponse expectedResponse =
+ SearchUrisResponse.newBuilder()
+ .setThreat(SearchUrisResponse.ThreatUri.newBuilder().build())
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ String uri = "uri116076";
+ List threatTypes = new ArrayList<>();
+
+ SearchUrisResponse actualResponse = client.searchUris(uri, threatTypes);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void searchUrisExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.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
+ public void searchHashesTest() throws Exception {
+ SearchHashesResponse expectedResponse =
+ SearchHashesResponse.newBuilder()
+ .addAllThreats(new ArrayList())
+ .setNegativeExpireTime(Timestamp.newBuilder().build())
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ ByteString hashPrefix = ByteString.EMPTY;
+ List threatTypes = new ArrayList<>();
+
+ SearchHashesResponse actualResponse = client.searchHashes(hashPrefix, threatTypes);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void searchHashesExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ ByteString hashPrefix = ByteString.EMPTY;
+ List threatTypes = new ArrayList<>();
+ client.searchHashes(hashPrefix, threatTypes);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+}
diff --git a/samples/snippets/generated/com/google/cloud/webrisk/v1/stub/webriskservicestubsettings/computethreatlistdiff/SyncComputeThreatListDiff.java b/samples/snippets/generated/com/google/cloud/webrisk/v1/stub/webriskservicestubsettings/computethreatlistdiff/SyncComputeThreatListDiff.java
new file mode 100644
index 00000000..74b80d5a
--- /dev/null
+++ b/samples/snippets/generated/com/google/cloud/webrisk/v1/stub/webriskservicestubsettings/computethreatlistdiff/SyncComputeThreatListDiff.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1.stub.samples;
+
+// [START webrisk_v1_generated_webriskservicestubsettings_computethreatlistdiff_sync]
+import com.google.cloud.webrisk.v1.stub.WebRiskServiceStubSettings;
+import java.time.Duration;
+
+public class SyncComputeThreatListDiff {
+
+ public static void main(String[] args) throws Exception {
+ syncComputeThreatListDiff();
+ }
+
+ public static void syncComputeThreatListDiff() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ WebRiskServiceStubSettings.Builder webRiskServiceSettingsBuilder =
+ WebRiskServiceStubSettings.newBuilder();
+ webRiskServiceSettingsBuilder
+ .computeThreatListDiffSettings()
+ .setRetrySettings(
+ webRiskServiceSettingsBuilder
+ .computeThreatListDiffSettings()
+ .getRetrySettings()
+ .toBuilder()
+ .setTotalTimeout(Duration.ofSeconds(30))
+ .build());
+ WebRiskServiceStubSettings webRiskServiceSettings = webRiskServiceSettingsBuilder.build();
+ }
+}
+// [END webrisk_v1_generated_webriskservicestubsettings_computethreatlistdiff_sync]
diff --git a/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/computethreatlistdiff/AsyncComputeThreatListDiff.java b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/computethreatlistdiff/AsyncComputeThreatListDiff.java
new file mode 100644
index 00000000..77634bb3
--- /dev/null
+++ b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/computethreatlistdiff/AsyncComputeThreatListDiff.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1.samples;
+
+// [START webrisk_v1_generated_webriskserviceclient_computethreatlistdiff_async]
+import com.google.api.core.ApiFuture;
+import com.google.cloud.webrisk.v1.WebRiskServiceClient;
+import com.google.protobuf.ByteString;
+import com.google.webrisk.v1.ComputeThreatListDiffRequest;
+import com.google.webrisk.v1.ComputeThreatListDiffResponse;
+import com.google.webrisk.v1.ThreatType;
+
+public class AsyncComputeThreatListDiff {
+
+ public static void main(String[] args) throws Exception {
+ asyncComputeThreatListDiff();
+ }
+
+ public static void asyncComputeThreatListDiff() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
+ ComputeThreatListDiffRequest request =
+ ComputeThreatListDiffRequest.newBuilder()
+ .setThreatType(ThreatType.forNumber(0))
+ .setVersionToken(ByteString.EMPTY)
+ .setConstraints(ComputeThreatListDiffRequest.Constraints.newBuilder().build())
+ .build();
+ ApiFuture future =
+ webRiskServiceClient.computeThreatListDiffCallable().futureCall(request);
+ // Do something.
+ ComputeThreatListDiffResponse response = future.get();
+ }
+ }
+}
+// [END webrisk_v1_generated_webriskserviceclient_computethreatlistdiff_async]
diff --git a/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/computethreatlistdiff/SyncComputeThreatListDiff.java b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/computethreatlistdiff/SyncComputeThreatListDiff.java
new file mode 100644
index 00000000..24f1309d
--- /dev/null
+++ b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/computethreatlistdiff/SyncComputeThreatListDiff.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1.samples;
+
+// [START webrisk_v1_generated_webriskserviceclient_computethreatlistdiff_sync]
+import com.google.cloud.webrisk.v1.WebRiskServiceClient;
+import com.google.protobuf.ByteString;
+import com.google.webrisk.v1.ComputeThreatListDiffRequest;
+import com.google.webrisk.v1.ComputeThreatListDiffResponse;
+import com.google.webrisk.v1.ThreatType;
+
+public class SyncComputeThreatListDiff {
+
+ public static void main(String[] args) throws Exception {
+ syncComputeThreatListDiff();
+ }
+
+ public static void syncComputeThreatListDiff() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
+ ComputeThreatListDiffRequest request =
+ ComputeThreatListDiffRequest.newBuilder()
+ .setThreatType(ThreatType.forNumber(0))
+ .setVersionToken(ByteString.EMPTY)
+ .setConstraints(ComputeThreatListDiffRequest.Constraints.newBuilder().build())
+ .build();
+ ComputeThreatListDiffResponse response = webRiskServiceClient.computeThreatListDiff(request);
+ }
+ }
+}
+// [END webrisk_v1_generated_webriskserviceclient_computethreatlistdiff_sync]
diff --git a/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/computethreatlistdiff/SyncComputeThreatListDiffThreattypeBytestringComputethreatlistdiffrequestconstraints.java b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/computethreatlistdiff/SyncComputeThreatListDiffThreattypeBytestringComputethreatlistdiffrequestconstraints.java
new file mode 100644
index 00000000..9f306fb9
--- /dev/null
+++ b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/computethreatlistdiff/SyncComputeThreatListDiffThreattypeBytestringComputethreatlistdiffrequestconstraints.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1.samples;
+
+// [START
+// webrisk_v1_generated_webriskserviceclient_computethreatlistdiff_threattypebytestringcomputethreatlistdiffrequestconstraints_sync]
+import com.google.cloud.webrisk.v1.WebRiskServiceClient;
+import com.google.protobuf.ByteString;
+import com.google.webrisk.v1.ComputeThreatListDiffRequest;
+import com.google.webrisk.v1.ComputeThreatListDiffResponse;
+import com.google.webrisk.v1.ThreatType;
+
+public class SyncComputeThreatListDiffThreattypeBytestringComputethreatlistdiffrequestconstraints {
+
+ public static void main(String[] args) throws Exception {
+ syncComputeThreatListDiffThreattypeBytestringComputethreatlistdiffrequestconstraints();
+ }
+
+ public static void
+ syncComputeThreatListDiffThreattypeBytestringComputethreatlistdiffrequestconstraints()
+ throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
+ ThreatType threatType = ThreatType.forNumber(0);
+ ByteString versionToken = ByteString.EMPTY;
+ ComputeThreatListDiffRequest.Constraints constraints =
+ ComputeThreatListDiffRequest.Constraints.newBuilder().build();
+ ComputeThreatListDiffResponse response =
+ webRiskServiceClient.computeThreatListDiff(threatType, versionToken, constraints);
+ }
+ }
+}
+// [END
+// webrisk_v1_generated_webriskserviceclient_computethreatlistdiff_threattypebytestringcomputethreatlistdiffrequestconstraints_sync]
diff --git a/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/create/SyncCreateSetCredentialsProvider.java
new file mode 100644
index 00000000..f3a2e919
--- /dev/null
+++ b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/create/SyncCreateSetCredentialsProvider.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1.samples;
+
+// [START webrisk_v1_generated_webriskserviceclient_create_setcredentialsprovider_sync]
+import com.google.api.gax.core.FixedCredentialsProvider;
+import com.google.cloud.webrisk.v1.WebRiskServiceClient;
+import com.google.cloud.webrisk.v1.WebRiskServiceSettings;
+import com.google.cloud.webrisk.v1.myCredentials;
+
+public class SyncCreateSetCredentialsProvider {
+
+ public static void main(String[] args) throws Exception {
+ syncCreateSetCredentialsProvider();
+ }
+
+ public static void syncCreateSetCredentialsProvider() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ WebRiskServiceSettings webRiskServiceSettings =
+ WebRiskServiceSettings.newBuilder()
+ .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ .build();
+ WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create(webRiskServiceSettings);
+ }
+}
+// [END webrisk_v1_generated_webriskserviceclient_create_setcredentialsprovider_sync]
diff --git a/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/create/SyncCreateSetCredentialsProvider1.java b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/create/SyncCreateSetCredentialsProvider1.java
new file mode 100644
index 00000000..964938f7
--- /dev/null
+++ b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/create/SyncCreateSetCredentialsProvider1.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1.samples;
+
+// [START webrisk_v1_generated_webriskserviceclient_create_setcredentialsprovider1_sync]
+import com.google.cloud.webrisk.v1.WebRiskServiceClient;
+import com.google.cloud.webrisk.v1.WebRiskServiceSettings;
+
+public class SyncCreateSetCredentialsProvider1 {
+
+ public static void main(String[] args) throws Exception {
+ syncCreateSetCredentialsProvider1();
+ }
+
+ public static void syncCreateSetCredentialsProvider1() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ WebRiskServiceSettings webRiskServiceSettings =
+ WebRiskServiceSettings.newBuilder()
+ .setTransportChannelProvider(
+ WebRiskServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
+ .build();
+ WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create(webRiskServiceSettings);
+ }
+}
+// [END webrisk_v1_generated_webriskserviceclient_create_setcredentialsprovider1_sync]
diff --git a/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/create/SyncCreateSetEndpoint.java
new file mode 100644
index 00000000..89b628e4
--- /dev/null
+++ b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/create/SyncCreateSetEndpoint.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1.samples;
+
+// [START webrisk_v1_generated_webriskserviceclient_create_setendpoint_sync]
+import com.google.cloud.webrisk.v1.WebRiskServiceClient;
+import com.google.cloud.webrisk.v1.WebRiskServiceSettings;
+import com.google.cloud.webrisk.v1.myEndpoint;
+
+public class SyncCreateSetEndpoint {
+
+ public static void main(String[] args) throws Exception {
+ syncCreateSetEndpoint();
+ }
+
+ public static void syncCreateSetEndpoint() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ WebRiskServiceSettings webRiskServiceSettings =
+ WebRiskServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create(webRiskServiceSettings);
+ }
+}
+// [END webrisk_v1_generated_webriskserviceclient_create_setendpoint_sync]
diff --git a/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/createsubmission/AsyncCreateSubmission.java b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/createsubmission/AsyncCreateSubmission.java
new file mode 100644
index 00000000..3a4d34a2
--- /dev/null
+++ b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/createsubmission/AsyncCreateSubmission.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1.samples;
+
+// [START webrisk_v1_generated_webriskserviceclient_createsubmission_async]
+import com.google.api.core.ApiFuture;
+import com.google.cloud.webrisk.v1.WebRiskServiceClient;
+import com.google.webrisk.v1.CreateSubmissionRequest;
+import com.google.webrisk.v1.ProjectName;
+import com.google.webrisk.v1.Submission;
+
+public class AsyncCreateSubmission {
+
+ public static void main(String[] args) throws Exception {
+ asyncCreateSubmission();
+ }
+
+ public static void asyncCreateSubmission() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
+ CreateSubmissionRequest request =
+ CreateSubmissionRequest.newBuilder()
+ .setParent(ProjectName.of("[PROJECT]").toString())
+ .setSubmission(Submission.newBuilder().build())
+ .build();
+ ApiFuture future =
+ webRiskServiceClient.createSubmissionCallable().futureCall(request);
+ // Do something.
+ Submission response = future.get();
+ }
+ }
+}
+// [END webrisk_v1_generated_webriskserviceclient_createsubmission_async]
diff --git a/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/createsubmission/SyncCreateSubmission.java b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/createsubmission/SyncCreateSubmission.java
new file mode 100644
index 00000000..9ca8abbe
--- /dev/null
+++ b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/createsubmission/SyncCreateSubmission.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1.samples;
+
+// [START webrisk_v1_generated_webriskserviceclient_createsubmission_sync]
+import com.google.cloud.webrisk.v1.WebRiskServiceClient;
+import com.google.webrisk.v1.CreateSubmissionRequest;
+import com.google.webrisk.v1.ProjectName;
+import com.google.webrisk.v1.Submission;
+
+public class SyncCreateSubmission {
+
+ public static void main(String[] args) throws Exception {
+ syncCreateSubmission();
+ }
+
+ public static void syncCreateSubmission() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
+ CreateSubmissionRequest request =
+ CreateSubmissionRequest.newBuilder()
+ .setParent(ProjectName.of("[PROJECT]").toString())
+ .setSubmission(Submission.newBuilder().build())
+ .build();
+ Submission response = webRiskServiceClient.createSubmission(request);
+ }
+ }
+}
+// [END webrisk_v1_generated_webriskserviceclient_createsubmission_sync]
diff --git a/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/createsubmission/SyncCreateSubmissionProjectnameSubmission.java b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/createsubmission/SyncCreateSubmissionProjectnameSubmission.java
new file mode 100644
index 00000000..dd3ac733
--- /dev/null
+++ b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/createsubmission/SyncCreateSubmissionProjectnameSubmission.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1.samples;
+
+// [START webrisk_v1_generated_webriskserviceclient_createsubmission_projectnamesubmission_sync]
+import com.google.cloud.webrisk.v1.WebRiskServiceClient;
+import com.google.webrisk.v1.ProjectName;
+import com.google.webrisk.v1.Submission;
+
+public class SyncCreateSubmissionProjectnameSubmission {
+
+ public static void main(String[] args) throws Exception {
+ syncCreateSubmissionProjectnameSubmission();
+ }
+
+ public static void syncCreateSubmissionProjectnameSubmission() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
+ ProjectName parent = ProjectName.of("[PROJECT]");
+ Submission submission = Submission.newBuilder().build();
+ Submission response = webRiskServiceClient.createSubmission(parent, submission);
+ }
+ }
+}
+// [END webrisk_v1_generated_webriskserviceclient_createsubmission_projectnamesubmission_sync]
diff --git a/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/createsubmission/SyncCreateSubmissionStringSubmission.java b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/createsubmission/SyncCreateSubmissionStringSubmission.java
new file mode 100644
index 00000000..42580a29
--- /dev/null
+++ b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/createsubmission/SyncCreateSubmissionStringSubmission.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1.samples;
+
+// [START webrisk_v1_generated_webriskserviceclient_createsubmission_stringsubmission_sync]
+import com.google.cloud.webrisk.v1.WebRiskServiceClient;
+import com.google.webrisk.v1.ProjectName;
+import com.google.webrisk.v1.Submission;
+
+public class SyncCreateSubmissionStringSubmission {
+
+ public static void main(String[] args) throws Exception {
+ syncCreateSubmissionStringSubmission();
+ }
+
+ public static void syncCreateSubmissionStringSubmission() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
+ String parent = ProjectName.of("[PROJECT]").toString();
+ Submission submission = Submission.newBuilder().build();
+ Submission response = webRiskServiceClient.createSubmission(parent, submission);
+ }
+ }
+}
+// [END webrisk_v1_generated_webriskserviceclient_createsubmission_stringsubmission_sync]
diff --git a/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/searchhashes/AsyncSearchHashes.java b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/searchhashes/AsyncSearchHashes.java
new file mode 100644
index 00000000..f28a6033
--- /dev/null
+++ b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/searchhashes/AsyncSearchHashes.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1.samples;
+
+// [START webrisk_v1_generated_webriskserviceclient_searchhashes_async]
+import com.google.api.core.ApiFuture;
+import com.google.cloud.webrisk.v1.WebRiskServiceClient;
+import com.google.protobuf.ByteString;
+import com.google.webrisk.v1.SearchHashesRequest;
+import com.google.webrisk.v1.SearchHashesResponse;
+import com.google.webrisk.v1.ThreatType;
+import java.util.ArrayList;
+
+public class AsyncSearchHashes {
+
+ public static void main(String[] args) throws Exception {
+ asyncSearchHashes();
+ }
+
+ public static void asyncSearchHashes() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
+ SearchHashesRequest request =
+ SearchHashesRequest.newBuilder()
+ .setHashPrefix(ByteString.EMPTY)
+ .addAllThreatTypes(new ArrayList())
+ .build();
+ ApiFuture future =
+ webRiskServiceClient.searchHashesCallable().futureCall(request);
+ // Do something.
+ SearchHashesResponse response = future.get();
+ }
+ }
+}
+// [END webrisk_v1_generated_webriskserviceclient_searchhashes_async]
diff --git a/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/searchhashes/SyncSearchHashes.java b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/searchhashes/SyncSearchHashes.java
new file mode 100644
index 00000000..90cde04f
--- /dev/null
+++ b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/searchhashes/SyncSearchHashes.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1.samples;
+
+// [START webrisk_v1_generated_webriskserviceclient_searchhashes_sync]
+import com.google.cloud.webrisk.v1.WebRiskServiceClient;
+import com.google.protobuf.ByteString;
+import com.google.webrisk.v1.SearchHashesRequest;
+import com.google.webrisk.v1.SearchHashesResponse;
+import com.google.webrisk.v1.ThreatType;
+import java.util.ArrayList;
+
+public class SyncSearchHashes {
+
+ public static void main(String[] args) throws Exception {
+ syncSearchHashes();
+ }
+
+ public static void syncSearchHashes() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
+ SearchHashesRequest request =
+ SearchHashesRequest.newBuilder()
+ .setHashPrefix(ByteString.EMPTY)
+ .addAllThreatTypes(new ArrayList())
+ .build();
+ SearchHashesResponse response = webRiskServiceClient.searchHashes(request);
+ }
+ }
+}
+// [END webrisk_v1_generated_webriskserviceclient_searchhashes_sync]
diff --git a/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/searchhashes/SyncSearchHashesBytestringListthreattype.java b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/searchhashes/SyncSearchHashesBytestringListthreattype.java
new file mode 100644
index 00000000..f94214cc
--- /dev/null
+++ b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/searchhashes/SyncSearchHashesBytestringListthreattype.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1.samples;
+
+// [START webrisk_v1_generated_webriskserviceclient_searchhashes_bytestringlistthreattype_sync]
+import com.google.cloud.webrisk.v1.WebRiskServiceClient;
+import com.google.protobuf.ByteString;
+import com.google.webrisk.v1.SearchHashesResponse;
+import com.google.webrisk.v1.ThreatType;
+import java.util.ArrayList;
+import java.util.List;
+
+public class SyncSearchHashesBytestringListthreattype {
+
+ public static void main(String[] args) throws Exception {
+ syncSearchHashesBytestringListthreattype();
+ }
+
+ public static void syncSearchHashesBytestringListthreattype() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
+ ByteString hashPrefix = ByteString.EMPTY;
+ List threatTypes = new ArrayList<>();
+ SearchHashesResponse response = webRiskServiceClient.searchHashes(hashPrefix, threatTypes);
+ }
+ }
+}
+// [END webrisk_v1_generated_webriskserviceclient_searchhashes_bytestringlistthreattype_sync]
diff --git a/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/searchuris/AsyncSearchUris.java b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/searchuris/AsyncSearchUris.java
new file mode 100644
index 00000000..483e8ebb
--- /dev/null
+++ b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/searchuris/AsyncSearchUris.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1.samples;
+
+// [START webrisk_v1_generated_webriskserviceclient_searchuris_async]
+import com.google.api.core.ApiFuture;
+import com.google.cloud.webrisk.v1.WebRiskServiceClient;
+import com.google.webrisk.v1.SearchUrisRequest;
+import com.google.webrisk.v1.SearchUrisResponse;
+import com.google.webrisk.v1.ThreatType;
+import java.util.ArrayList;
+
+public class AsyncSearchUris {
+
+ public static void main(String[] args) throws Exception {
+ asyncSearchUris();
+ }
+
+ public static void asyncSearchUris() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
+ SearchUrisRequest request =
+ SearchUrisRequest.newBuilder()
+ .setUri("uri116076")
+ .addAllThreatTypes(new ArrayList())
+ .build();
+ ApiFuture future =
+ webRiskServiceClient.searchUrisCallable().futureCall(request);
+ // Do something.
+ SearchUrisResponse response = future.get();
+ }
+ }
+}
+// [END webrisk_v1_generated_webriskserviceclient_searchuris_async]
diff --git a/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/searchuris/SyncSearchUris.java b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/searchuris/SyncSearchUris.java
new file mode 100644
index 00000000..bce66612
--- /dev/null
+++ b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/searchuris/SyncSearchUris.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1.samples;
+
+// [START webrisk_v1_generated_webriskserviceclient_searchuris_sync]
+import com.google.cloud.webrisk.v1.WebRiskServiceClient;
+import com.google.webrisk.v1.SearchUrisRequest;
+import com.google.webrisk.v1.SearchUrisResponse;
+import com.google.webrisk.v1.ThreatType;
+import java.util.ArrayList;
+
+public class SyncSearchUris {
+
+ public static void main(String[] args) throws Exception {
+ syncSearchUris();
+ }
+
+ public static void syncSearchUris() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
+ SearchUrisRequest request =
+ SearchUrisRequest.newBuilder()
+ .setUri("uri116076")
+ .addAllThreatTypes(new ArrayList())
+ .build();
+ SearchUrisResponse response = webRiskServiceClient.searchUris(request);
+ }
+ }
+}
+// [END webrisk_v1_generated_webriskserviceclient_searchuris_sync]
diff --git a/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/searchuris/SyncSearchUrisStringListthreattype.java b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/searchuris/SyncSearchUrisStringListthreattype.java
new file mode 100644
index 00000000..56da0a9b
--- /dev/null
+++ b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskserviceclient/searchuris/SyncSearchUrisStringListthreattype.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1.samples;
+
+// [START webrisk_v1_generated_webriskserviceclient_searchuris_stringlistthreattype_sync]
+import com.google.cloud.webrisk.v1.WebRiskServiceClient;
+import com.google.webrisk.v1.SearchUrisResponse;
+import com.google.webrisk.v1.ThreatType;
+import java.util.ArrayList;
+import java.util.List;
+
+public class SyncSearchUrisStringListthreattype {
+
+ public static void main(String[] args) throws Exception {
+ syncSearchUrisStringListthreattype();
+ }
+
+ public static void syncSearchUrisStringListthreattype() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
+ String uri = "uri116076";
+ List threatTypes = new ArrayList<>();
+ SearchUrisResponse response = webRiskServiceClient.searchUris(uri, threatTypes);
+ }
+ }
+}
+// [END webrisk_v1_generated_webriskserviceclient_searchuris_stringlistthreattype_sync]
diff --git a/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskservicesettings/computethreatlistdiff/SyncComputeThreatListDiff.java b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskservicesettings/computethreatlistdiff/SyncComputeThreatListDiff.java
new file mode 100644
index 00000000..4fda87f2
--- /dev/null
+++ b/samples/snippets/generated/com/google/cloud/webrisk/v1/webriskservicesettings/computethreatlistdiff/SyncComputeThreatListDiff.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1.samples;
+
+// [START webrisk_v1_generated_webriskservicesettings_computethreatlistdiff_sync]
+import com.google.cloud.webrisk.v1.WebRiskServiceSettings;
+import java.time.Duration;
+
+public class SyncComputeThreatListDiff {
+
+ public static void main(String[] args) throws Exception {
+ syncComputeThreatListDiff();
+ }
+
+ public static void syncComputeThreatListDiff() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ WebRiskServiceSettings.Builder webRiskServiceSettingsBuilder =
+ WebRiskServiceSettings.newBuilder();
+ webRiskServiceSettingsBuilder
+ .computeThreatListDiffSettings()
+ .setRetrySettings(
+ webRiskServiceSettingsBuilder
+ .computeThreatListDiffSettings()
+ .getRetrySettings()
+ .toBuilder()
+ .setTotalTimeout(Duration.ofSeconds(30))
+ .build());
+ WebRiskServiceSettings webRiskServiceSettings = webRiskServiceSettingsBuilder.build();
+ }
+}
+// [END webrisk_v1_generated_webriskservicesettings_computethreatlistdiff_sync]
diff --git a/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/stub/webriskservicev1beta1stubsettings/computethreatlistdiff/SyncComputeThreatListDiff.java b/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/stub/webriskservicev1beta1stubsettings/computethreatlistdiff/SyncComputeThreatListDiff.java
new file mode 100644
index 00000000..0dd00ed4
--- /dev/null
+++ b/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/stub/webriskservicev1beta1stubsettings/computethreatlistdiff/SyncComputeThreatListDiff.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1beta1.stub.samples;
+
+// [START webrisk_v1beta1_generated_webriskservicev1beta1stubsettings_computethreatlistdiff_sync]
+import com.google.cloud.webrisk.v1beta1.stub.WebRiskServiceV1Beta1StubSettings;
+import java.time.Duration;
+
+public class SyncComputeThreatListDiff {
+
+ public static void main(String[] args) throws Exception {
+ syncComputeThreatListDiff();
+ }
+
+ public static void syncComputeThreatListDiff() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ WebRiskServiceV1Beta1StubSettings.Builder webRiskServiceV1Beta1SettingsBuilder =
+ WebRiskServiceV1Beta1StubSettings.newBuilder();
+ webRiskServiceV1Beta1SettingsBuilder
+ .computeThreatListDiffSettings()
+ .setRetrySettings(
+ webRiskServiceV1Beta1SettingsBuilder
+ .computeThreatListDiffSettings()
+ .getRetrySettings()
+ .toBuilder()
+ .setTotalTimeout(Duration.ofSeconds(30))
+ .build());
+ WebRiskServiceV1Beta1StubSettings webRiskServiceV1Beta1Settings =
+ webRiskServiceV1Beta1SettingsBuilder.build();
+ }
+}
+// [END webrisk_v1beta1_generated_webriskservicev1beta1stubsettings_computethreatlistdiff_sync]
diff --git a/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/computethreatlistdiff/AsyncComputeThreatListDiff.java b/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/computethreatlistdiff/AsyncComputeThreatListDiff.java
new file mode 100644
index 00000000..e8f41e27
--- /dev/null
+++ b/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/computethreatlistdiff/AsyncComputeThreatListDiff.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1beta1.samples;
+
+// [START webrisk_v1beta1_generated_webriskservicev1beta1client_computethreatlistdiff_async]
+import com.google.api.core.ApiFuture;
+import com.google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1Client;
+import com.google.protobuf.ByteString;
+import com.google.webrisk.v1beta1.ComputeThreatListDiffRequest;
+import com.google.webrisk.v1beta1.ComputeThreatListDiffResponse;
+import com.google.webrisk.v1beta1.ThreatType;
+
+public class AsyncComputeThreatListDiff {
+
+ public static void main(String[] args) throws Exception {
+ asyncComputeThreatListDiff();
+ }
+
+ public static void asyncComputeThreatListDiff() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client =
+ WebRiskServiceV1Beta1Client.create()) {
+ ComputeThreatListDiffRequest request =
+ ComputeThreatListDiffRequest.newBuilder()
+ .setThreatType(ThreatType.forNumber(0))
+ .setVersionToken(ByteString.EMPTY)
+ .setConstraints(ComputeThreatListDiffRequest.Constraints.newBuilder().build())
+ .build();
+ ApiFuture future =
+ webRiskServiceV1Beta1Client.computeThreatListDiffCallable().futureCall(request);
+ // Do something.
+ ComputeThreatListDiffResponse response = future.get();
+ }
+ }
+}
+// [END webrisk_v1beta1_generated_webriskservicev1beta1client_computethreatlistdiff_async]
diff --git a/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/computethreatlistdiff/SyncComputeThreatListDiff.java b/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/computethreatlistdiff/SyncComputeThreatListDiff.java
new file mode 100644
index 00000000..f2280dc4
--- /dev/null
+++ b/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/computethreatlistdiff/SyncComputeThreatListDiff.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1beta1.samples;
+
+// [START webrisk_v1beta1_generated_webriskservicev1beta1client_computethreatlistdiff_sync]
+import com.google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1Client;
+import com.google.protobuf.ByteString;
+import com.google.webrisk.v1beta1.ComputeThreatListDiffRequest;
+import com.google.webrisk.v1beta1.ComputeThreatListDiffResponse;
+import com.google.webrisk.v1beta1.ThreatType;
+
+public class SyncComputeThreatListDiff {
+
+ public static void main(String[] args) throws Exception {
+ syncComputeThreatListDiff();
+ }
+
+ public static void syncComputeThreatListDiff() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client =
+ WebRiskServiceV1Beta1Client.create()) {
+ ComputeThreatListDiffRequest request =
+ ComputeThreatListDiffRequest.newBuilder()
+ .setThreatType(ThreatType.forNumber(0))
+ .setVersionToken(ByteString.EMPTY)
+ .setConstraints(ComputeThreatListDiffRequest.Constraints.newBuilder().build())
+ .build();
+ ComputeThreatListDiffResponse response =
+ webRiskServiceV1Beta1Client.computeThreatListDiff(request);
+ }
+ }
+}
+// [END webrisk_v1beta1_generated_webriskservicev1beta1client_computethreatlistdiff_sync]
diff --git a/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/computethreatlistdiff/SyncComputeThreatListDiffThreattypeBytestringComputethreatlistdiffrequestconstraints.java b/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/computethreatlistdiff/SyncComputeThreatListDiffThreattypeBytestringComputethreatlistdiffrequestconstraints.java
new file mode 100644
index 00000000..381a0f91
--- /dev/null
+++ b/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/computethreatlistdiff/SyncComputeThreatListDiffThreattypeBytestringComputethreatlistdiffrequestconstraints.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1beta1.samples;
+
+// [START
+// webrisk_v1beta1_generated_webriskservicev1beta1client_computethreatlistdiff_threattypebytestringcomputethreatlistdiffrequestconstraints_sync]
+import com.google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1Client;
+import com.google.protobuf.ByteString;
+import com.google.webrisk.v1beta1.ComputeThreatListDiffRequest;
+import com.google.webrisk.v1beta1.ComputeThreatListDiffResponse;
+import com.google.webrisk.v1beta1.ThreatType;
+
+public class SyncComputeThreatListDiffThreattypeBytestringComputethreatlistdiffrequestconstraints {
+
+ public static void main(String[] args) throws Exception {
+ syncComputeThreatListDiffThreattypeBytestringComputethreatlistdiffrequestconstraints();
+ }
+
+ public static void
+ syncComputeThreatListDiffThreattypeBytestringComputethreatlistdiffrequestconstraints()
+ throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client =
+ WebRiskServiceV1Beta1Client.create()) {
+ ThreatType threatType = ThreatType.forNumber(0);
+ ByteString versionToken = ByteString.EMPTY;
+ ComputeThreatListDiffRequest.Constraints constraints =
+ ComputeThreatListDiffRequest.Constraints.newBuilder().build();
+ ComputeThreatListDiffResponse response =
+ webRiskServiceV1Beta1Client.computeThreatListDiff(threatType, versionToken, constraints);
+ }
+ }
+}
+// [END
+// webrisk_v1beta1_generated_webriskservicev1beta1client_computethreatlistdiff_threattypebytestringcomputethreatlistdiffrequestconstraints_sync]
diff --git a/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/create/SyncCreateSetCredentialsProvider.java
new file mode 100644
index 00000000..fbce7869
--- /dev/null
+++ b/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/create/SyncCreateSetCredentialsProvider.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1beta1.samples;
+
+// [START webrisk_v1beta1_generated_webriskservicev1beta1client_create_setcredentialsprovider_sync]
+import com.google.api.gax.core.FixedCredentialsProvider;
+import com.google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1Client;
+import com.google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1Settings;
+import com.google.cloud.webrisk.v1beta1.myCredentials;
+
+public class SyncCreateSetCredentialsProvider {
+
+ public static void main(String[] args) throws Exception {
+ syncCreateSetCredentialsProvider();
+ }
+
+ public static void syncCreateSetCredentialsProvider() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ WebRiskServiceV1Beta1Settings webRiskServiceV1Beta1Settings =
+ WebRiskServiceV1Beta1Settings.newBuilder()
+ .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ .build();
+ WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client =
+ WebRiskServiceV1Beta1Client.create(webRiskServiceV1Beta1Settings);
+ }
+}
+// [END webrisk_v1beta1_generated_webriskservicev1beta1client_create_setcredentialsprovider_sync]
diff --git a/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/create/SyncCreateSetCredentialsProvider1.java b/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/create/SyncCreateSetCredentialsProvider1.java
new file mode 100644
index 00000000..4db1a8d2
--- /dev/null
+++ b/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/create/SyncCreateSetCredentialsProvider1.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1beta1.samples;
+
+// [START webrisk_v1beta1_generated_webriskservicev1beta1client_create_setcredentialsprovider1_sync]
+import com.google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1Client;
+import com.google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1Settings;
+
+public class SyncCreateSetCredentialsProvider1 {
+
+ public static void main(String[] args) throws Exception {
+ syncCreateSetCredentialsProvider1();
+ }
+
+ public static void syncCreateSetCredentialsProvider1() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ WebRiskServiceV1Beta1Settings webRiskServiceV1Beta1Settings =
+ WebRiskServiceV1Beta1Settings.newBuilder()
+ .setTransportChannelProvider(
+ WebRiskServiceV1Beta1Settings.defaultHttpJsonTransportProviderBuilder().build())
+ .build();
+ WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client =
+ WebRiskServiceV1Beta1Client.create(webRiskServiceV1Beta1Settings);
+ }
+}
+// [END webrisk_v1beta1_generated_webriskservicev1beta1client_create_setcredentialsprovider1_sync]
diff --git a/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/create/SyncCreateSetEndpoint.java
new file mode 100644
index 00000000..28d6409b
--- /dev/null
+++ b/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/create/SyncCreateSetEndpoint.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1beta1.samples;
+
+// [START webrisk_v1beta1_generated_webriskservicev1beta1client_create_setendpoint_sync]
+import com.google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1Client;
+import com.google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1Settings;
+import com.google.cloud.webrisk.v1beta1.myEndpoint;
+
+public class SyncCreateSetEndpoint {
+
+ public static void main(String[] args) throws Exception {
+ syncCreateSetEndpoint();
+ }
+
+ public static void syncCreateSetEndpoint() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ WebRiskServiceV1Beta1Settings webRiskServiceV1Beta1Settings =
+ WebRiskServiceV1Beta1Settings.newBuilder().setEndpoint(myEndpoint).build();
+ WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client =
+ WebRiskServiceV1Beta1Client.create(webRiskServiceV1Beta1Settings);
+ }
+}
+// [END webrisk_v1beta1_generated_webriskservicev1beta1client_create_setendpoint_sync]
diff --git a/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/searchhashes/AsyncSearchHashes.java b/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/searchhashes/AsyncSearchHashes.java
new file mode 100644
index 00000000..299b3001
--- /dev/null
+++ b/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/searchhashes/AsyncSearchHashes.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1beta1.samples;
+
+// [START webrisk_v1beta1_generated_webriskservicev1beta1client_searchhashes_async]
+import com.google.api.core.ApiFuture;
+import com.google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1Client;
+import com.google.protobuf.ByteString;
+import com.google.webrisk.v1beta1.SearchHashesRequest;
+import com.google.webrisk.v1beta1.SearchHashesResponse;
+import com.google.webrisk.v1beta1.ThreatType;
+import java.util.ArrayList;
+
+public class AsyncSearchHashes {
+
+ public static void main(String[] args) throws Exception {
+ asyncSearchHashes();
+ }
+
+ public static void asyncSearchHashes() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client =
+ WebRiskServiceV1Beta1Client.create()) {
+ SearchHashesRequest request =
+ SearchHashesRequest.newBuilder()
+ .setHashPrefix(ByteString.EMPTY)
+ .addAllThreatTypes(new ArrayList())
+ .build();
+ ApiFuture future =
+ webRiskServiceV1Beta1Client.searchHashesCallable().futureCall(request);
+ // Do something.
+ SearchHashesResponse response = future.get();
+ }
+ }
+}
+// [END webrisk_v1beta1_generated_webriskservicev1beta1client_searchhashes_async]
diff --git a/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/searchhashes/SyncSearchHashes.java b/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/searchhashes/SyncSearchHashes.java
new file mode 100644
index 00000000..3144b1e5
--- /dev/null
+++ b/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/searchhashes/SyncSearchHashes.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1beta1.samples;
+
+// [START webrisk_v1beta1_generated_webriskservicev1beta1client_searchhashes_sync]
+import com.google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1Client;
+import com.google.protobuf.ByteString;
+import com.google.webrisk.v1beta1.SearchHashesRequest;
+import com.google.webrisk.v1beta1.SearchHashesResponse;
+import com.google.webrisk.v1beta1.ThreatType;
+import java.util.ArrayList;
+
+public class SyncSearchHashes {
+
+ public static void main(String[] args) throws Exception {
+ syncSearchHashes();
+ }
+
+ public static void syncSearchHashes() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client =
+ WebRiskServiceV1Beta1Client.create()) {
+ SearchHashesRequest request =
+ SearchHashesRequest.newBuilder()
+ .setHashPrefix(ByteString.EMPTY)
+ .addAllThreatTypes(new ArrayList())
+ .build();
+ SearchHashesResponse response = webRiskServiceV1Beta1Client.searchHashes(request);
+ }
+ }
+}
+// [END webrisk_v1beta1_generated_webriskservicev1beta1client_searchhashes_sync]
diff --git a/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/searchhashes/SyncSearchHashesBytestringListthreattype.java b/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/searchhashes/SyncSearchHashesBytestringListthreattype.java
new file mode 100644
index 00000000..e18a0f32
--- /dev/null
+++ b/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/searchhashes/SyncSearchHashesBytestringListthreattype.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1beta1.samples;
+
+// [START
+// webrisk_v1beta1_generated_webriskservicev1beta1client_searchhashes_bytestringlistthreattype_sync]
+import com.google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1Client;
+import com.google.protobuf.ByteString;
+import com.google.webrisk.v1beta1.SearchHashesResponse;
+import com.google.webrisk.v1beta1.ThreatType;
+import java.util.ArrayList;
+import java.util.List;
+
+public class SyncSearchHashesBytestringListthreattype {
+
+ public static void main(String[] args) throws Exception {
+ syncSearchHashesBytestringListthreattype();
+ }
+
+ public static void syncSearchHashesBytestringListthreattype() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client =
+ WebRiskServiceV1Beta1Client.create()) {
+ ByteString hashPrefix = ByteString.EMPTY;
+ List threatTypes = new ArrayList<>();
+ SearchHashesResponse response =
+ webRiskServiceV1Beta1Client.searchHashes(hashPrefix, threatTypes);
+ }
+ }
+}
+// [END
+// webrisk_v1beta1_generated_webriskservicev1beta1client_searchhashes_bytestringlistthreattype_sync]
diff --git a/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/searchuris/AsyncSearchUris.java b/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/searchuris/AsyncSearchUris.java
new file mode 100644
index 00000000..376b233f
--- /dev/null
+++ b/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/searchuris/AsyncSearchUris.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1beta1.samples;
+
+// [START webrisk_v1beta1_generated_webriskservicev1beta1client_searchuris_async]
+import com.google.api.core.ApiFuture;
+import com.google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1Client;
+import com.google.webrisk.v1beta1.SearchUrisRequest;
+import com.google.webrisk.v1beta1.SearchUrisResponse;
+import com.google.webrisk.v1beta1.ThreatType;
+import java.util.ArrayList;
+
+public class AsyncSearchUris {
+
+ public static void main(String[] args) throws Exception {
+ asyncSearchUris();
+ }
+
+ public static void asyncSearchUris() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client =
+ WebRiskServiceV1Beta1Client.create()) {
+ SearchUrisRequest request =
+ SearchUrisRequest.newBuilder()
+ .setUri("uri116076")
+ .addAllThreatTypes(new ArrayList())
+ .build();
+ ApiFuture future =
+ webRiskServiceV1Beta1Client.searchUrisCallable().futureCall(request);
+ // Do something.
+ SearchUrisResponse response = future.get();
+ }
+ }
+}
+// [END webrisk_v1beta1_generated_webriskservicev1beta1client_searchuris_async]
diff --git a/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/searchuris/SyncSearchUris.java b/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/searchuris/SyncSearchUris.java
new file mode 100644
index 00000000..3e82a581
--- /dev/null
+++ b/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/searchuris/SyncSearchUris.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1beta1.samples;
+
+// [START webrisk_v1beta1_generated_webriskservicev1beta1client_searchuris_sync]
+import com.google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1Client;
+import com.google.webrisk.v1beta1.SearchUrisRequest;
+import com.google.webrisk.v1beta1.SearchUrisResponse;
+import com.google.webrisk.v1beta1.ThreatType;
+import java.util.ArrayList;
+
+public class SyncSearchUris {
+
+ public static void main(String[] args) throws Exception {
+ syncSearchUris();
+ }
+
+ public static void syncSearchUris() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client =
+ WebRiskServiceV1Beta1Client.create()) {
+ SearchUrisRequest request =
+ SearchUrisRequest.newBuilder()
+ .setUri("uri116076")
+ .addAllThreatTypes(new ArrayList())
+ .build();
+ SearchUrisResponse response = webRiskServiceV1Beta1Client.searchUris(request);
+ }
+ }
+}
+// [END webrisk_v1beta1_generated_webriskservicev1beta1client_searchuris_sync]
diff --git a/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/searchuris/SyncSearchUrisStringListthreattype.java b/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/searchuris/SyncSearchUrisStringListthreattype.java
new file mode 100644
index 00000000..575f50cf
--- /dev/null
+++ b/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1client/searchuris/SyncSearchUrisStringListthreattype.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1beta1.samples;
+
+// [START
+// webrisk_v1beta1_generated_webriskservicev1beta1client_searchuris_stringlistthreattype_sync]
+import com.google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1Client;
+import com.google.webrisk.v1beta1.SearchUrisResponse;
+import com.google.webrisk.v1beta1.ThreatType;
+import java.util.ArrayList;
+import java.util.List;
+
+public class SyncSearchUrisStringListthreattype {
+
+ public static void main(String[] args) throws Exception {
+ syncSearchUrisStringListthreattype();
+ }
+
+ public static void syncSearchUrisStringListthreattype() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client =
+ WebRiskServiceV1Beta1Client.create()) {
+ String uri = "uri116076";
+ List threatTypes = new ArrayList<>();
+ SearchUrisResponse response = webRiskServiceV1Beta1Client.searchUris(uri, threatTypes);
+ }
+ }
+}
+// [END webrisk_v1beta1_generated_webriskservicev1beta1client_searchuris_stringlistthreattype_sync]
diff --git a/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1settings/computethreatlistdiff/SyncComputeThreatListDiff.java b/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1settings/computethreatlistdiff/SyncComputeThreatListDiff.java
new file mode 100644
index 00000000..00ae94c4
--- /dev/null
+++ b/samples/snippets/generated/com/google/cloud/webrisk/v1beta1/webriskservicev1beta1settings/computethreatlistdiff/SyncComputeThreatListDiff.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.webrisk.v1beta1.samples;
+
+// [START webrisk_v1beta1_generated_webriskservicev1beta1settings_computethreatlistdiff_sync]
+import com.google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1Settings;
+import java.time.Duration;
+
+public class SyncComputeThreatListDiff {
+
+ public static void main(String[] args) throws Exception {
+ syncComputeThreatListDiff();
+ }
+
+ public static void syncComputeThreatListDiff() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ WebRiskServiceV1Beta1Settings.Builder webRiskServiceV1Beta1SettingsBuilder =
+ WebRiskServiceV1Beta1Settings.newBuilder();
+ webRiskServiceV1Beta1SettingsBuilder
+ .computeThreatListDiffSettings()
+ .setRetrySettings(
+ webRiskServiceV1Beta1SettingsBuilder
+ .computeThreatListDiffSettings()
+ .getRetrySettings()
+ .toBuilder()
+ .setTotalTimeout(Duration.ofSeconds(30))
+ .build());
+ WebRiskServiceV1Beta1Settings webRiskServiceV1Beta1Settings =
+ webRiskServiceV1Beta1SettingsBuilder.build();
+ }
+}
+// [END webrisk_v1beta1_generated_webriskservicev1beta1settings_computethreatlistdiff_sync]