@Generated(value="by gapic-generator") @BetaApi public class WebRiskServiceV1Beta1Client extends Object implements com.google.api.gax.core.BackgroundResource
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
try (WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = WebRiskServiceV1Beta1Client.create()) {
ThreatType threatType = ThreatType.THREAT_TYPE_UNSPECIFIED;
ByteString versionToken = ByteString.copyFromUtf8("");
ComputeThreatListDiffRequest.Constraints constraints = ComputeThreatListDiffRequest.Constraints.newBuilder().build();
ComputeThreatListDiffResponse response = webRiskServiceV1Beta1Client.computeThreatListDiff(threatType, versionToken, constraints);
}
Note: close() needs to be called on the webRiskServiceV1Beta1Client object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of WebRiskServiceV1Beta1Settings to create(). For example:
To customize credentials:
WebRiskServiceV1Beta1Settings webRiskServiceV1Beta1Settings =
WebRiskServiceV1Beta1Settings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client =
WebRiskServiceV1Beta1Client.create(webRiskServiceV1Beta1Settings);
To customize the endpoint:
WebRiskServiceV1Beta1Settings webRiskServiceV1Beta1Settings =
WebRiskServiceV1Beta1Settings.newBuilder().setEndpoint(myEndpoint).build();
WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client =
WebRiskServiceV1Beta1Client.create(webRiskServiceV1Beta1Settings);
Modifier | Constructor and Description |
---|---|
protected |
WebRiskServiceV1Beta1Client(WebRiskServiceV1Beta1Settings settings)
Constructs an instance of WebRiskServiceV1Beta1Client, using the given settings.
|
protected |
WebRiskServiceV1Beta1Client(WebRiskServiceV1Beta1Stub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
ComputeThreatListDiffResponse |
computeThreatListDiff(ComputeThreatListDiffRequest request)
Gets the most recent threat list diffs.
|
ComputeThreatListDiffResponse |
computeThreatListDiff(ThreatType threatType,
ByteString versionToken,
ComputeThreatListDiffRequest.Constraints constraints)
Gets the most recent threat list diffs.
|
com.google.api.gax.rpc.UnaryCallable<ComputeThreatListDiffRequest,ComputeThreatListDiffResponse> |
computeThreatListDiffCallable()
Gets the most recent threat list diffs.
|
static WebRiskServiceV1Beta1Client |
create()
Constructs an instance of WebRiskServiceV1Beta1Client with default settings.
|
static WebRiskServiceV1Beta1Client |
create(WebRiskServiceV1Beta1Settings settings)
Constructs an instance of WebRiskServiceV1Beta1Client, using the given settings.
|
static WebRiskServiceV1Beta1Client |
create(WebRiskServiceV1Beta1Stub stub)
Constructs an instance of WebRiskServiceV1Beta1Client, using the given stub for making calls.
|
WebRiskServiceV1Beta1Settings |
getSettings() |
WebRiskServiceV1Beta1Stub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
SearchHashesResponse |
searchHashes(ByteString hashPrefix,
List<ThreatType> threatTypes)
Gets the full hashes that match the requested hash prefix.
|
SearchHashesResponse |
searchHashes(SearchHashesRequest request)
Gets the full hashes that match the requested hash prefix.
|
com.google.api.gax.rpc.UnaryCallable<SearchHashesRequest,SearchHashesResponse> |
searchHashesCallable()
Gets the full hashes that match the requested hash prefix.
|
SearchUrisResponse |
searchUris(SearchUrisRequest request)
This method is used to check whether a URI is on a given threatList.
|
SearchUrisResponse |
searchUris(String uri,
List<ThreatType> threatTypes)
This method is used to check whether a URI is on a given threatList.
|
com.google.api.gax.rpc.UnaryCallable<SearchUrisRequest,SearchUrisResponse> |
searchUrisCallable()
This method is used to check whether a URI is on a given threatList.
|
void |
shutdown() |
void |
shutdownNow() |
protected WebRiskServiceV1Beta1Client(WebRiskServiceV1Beta1Settings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected WebRiskServiceV1Beta1Client(WebRiskServiceV1Beta1Stub stub)
public static final WebRiskServiceV1Beta1Client create() throws IOException
IOException
public static final WebRiskServiceV1Beta1Client create(WebRiskServiceV1Beta1Settings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final WebRiskServiceV1Beta1Client create(WebRiskServiceV1Beta1Stub stub)
public final WebRiskServiceV1Beta1Settings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public WebRiskServiceV1Beta1Stub getStub()
public final ComputeThreatListDiffResponse computeThreatListDiff(ThreatType threatType, ByteString versionToken, ComputeThreatListDiffRequest.Constraints constraints)
Sample code:
try (WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = WebRiskServiceV1Beta1Client.create()) {
ThreatType threatType = ThreatType.THREAT_TYPE_UNSPECIFIED;
ByteString versionToken = ByteString.copyFromUtf8("");
ComputeThreatListDiffRequest.Constraints constraints = ComputeThreatListDiffRequest.Constraints.newBuilder().build();
ComputeThreatListDiffResponse response = webRiskServiceV1Beta1Client.computeThreatListDiff(threatType, versionToken, constraints);
}
threatType
- The ThreatList to update.versionToken
- The current version token of the client for the requested list (the client
version that was received from the last successful diff).constraints
- Required. The constraints associated with this request.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final ComputeThreatListDiffResponse computeThreatListDiff(ComputeThreatListDiffRequest request)
Sample code:
try (WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = WebRiskServiceV1Beta1Client.create()) {
ThreatType threatType = ThreatType.THREAT_TYPE_UNSPECIFIED;
ComputeThreatListDiffRequest.Constraints constraints = ComputeThreatListDiffRequest.Constraints.newBuilder().build();
ComputeThreatListDiffRequest request = ComputeThreatListDiffRequest.newBuilder()
.setThreatType(threatType)
.setConstraints(constraints)
.build();
ComputeThreatListDiffResponse response = webRiskServiceV1Beta1Client.computeThreatListDiff(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ComputeThreatListDiffRequest,ComputeThreatListDiffResponse> computeThreatListDiffCallable()
Sample code:
try (WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = WebRiskServiceV1Beta1Client.create()) {
ThreatType threatType = ThreatType.THREAT_TYPE_UNSPECIFIED;
ComputeThreatListDiffRequest.Constraints constraints = ComputeThreatListDiffRequest.Constraints.newBuilder().build();
ComputeThreatListDiffRequest request = ComputeThreatListDiffRequest.newBuilder()
.setThreatType(threatType)
.setConstraints(constraints)
.build();
ApiFuture<ComputeThreatListDiffResponse> future = webRiskServiceV1Beta1Client.computeThreatListDiffCallable().futureCall(request);
// Do something
ComputeThreatListDiffResponse response = future.get();
}
public final SearchUrisResponse searchUris(String uri, List<ThreatType> threatTypes)
Sample code:
try (WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = WebRiskServiceV1Beta1Client.create()) {
String uri = "";
List<ThreatType> threatTypes = new ArrayList<>();
SearchUrisResponse response = webRiskServiceV1Beta1Client.searchUris(uri, threatTypes);
}
uri
- Required. The URI to be checked for matches.threatTypes
- Required. The ThreatLists to search in.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final SearchUrisResponse searchUris(SearchUrisRequest request)
Sample code:
try (WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = WebRiskServiceV1Beta1Client.create()) {
String uri = "";
List<ThreatType> threatTypes = new ArrayList<>();
SearchUrisRequest request = SearchUrisRequest.newBuilder()
.setUri(uri)
.addAllThreatTypes(threatTypes)
.build();
SearchUrisResponse response = webRiskServiceV1Beta1Client.searchUris(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<SearchUrisRequest,SearchUrisResponse> searchUrisCallable()
Sample code:
try (WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = WebRiskServiceV1Beta1Client.create()) {
String uri = "";
List<ThreatType> threatTypes = new ArrayList<>();
SearchUrisRequest request = SearchUrisRequest.newBuilder()
.setUri(uri)
.addAllThreatTypes(threatTypes)
.build();
ApiFuture<SearchUrisResponse> future = webRiskServiceV1Beta1Client.searchUrisCallable().futureCall(request);
// Do something
SearchUrisResponse response = future.get();
}
public final SearchHashesResponse searchHashes(ByteString hashPrefix, List<ThreatType> threatTypes)
Sample code:
try (WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = WebRiskServiceV1Beta1Client.create()) {
ByteString hashPrefix = ByteString.copyFromUtf8("");
List<ThreatType> threatTypes = new ArrayList<>();
SearchHashesResponse response = webRiskServiceV1Beta1Client.searchHashes(hashPrefix, threatTypes);
}
hashPrefix
- A hash prefix, consisting of the most significant 4-32 bytes of a SHA256
hash. For JSON requests, this field is base64-encoded.threatTypes
- Required. The ThreatLists to search in.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final SearchHashesResponse searchHashes(SearchHashesRequest request)
Sample code:
try (WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = WebRiskServiceV1Beta1Client.create()) {
List<ThreatType> threatTypes = new ArrayList<>();
SearchHashesRequest request = SearchHashesRequest.newBuilder()
.addAllThreatTypes(threatTypes)
.build();
SearchHashesResponse response = webRiskServiceV1Beta1Client.searchHashes(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<SearchHashesRequest,SearchHashesResponse> searchHashesCallable()
Sample code:
try (WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = WebRiskServiceV1Beta1Client.create()) {
List<ThreatType> threatTypes = new ArrayList<>();
SearchHashesRequest request = SearchHashesRequest.newBuilder()
.addAllThreatTypes(threatTypes)
.build();
ApiFuture<SearchHashesResponse> future = webRiskServiceV1Beta1Client.searchHashesCallable().futureCall(request);
// Do something
SearchHashesResponse response = future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isShutdown()
isShutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isTerminated()
isTerminated
in interface com.google.api.gax.core.BackgroundResource
public void shutdownNow()
shutdownNow
in interface com.google.api.gax.core.BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface com.google.api.gax.core.BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.