@Generated(value="by gapic-generator") @BetaApi public class WebRiskServiceV1Beta1Client extends Object implements 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() |
com.google.webrisk.v1beta1.ComputeThreatListDiffResponse |
computeThreatListDiff(com.google.webrisk.v1beta1.ComputeThreatListDiffRequest request)
Gets the most recent threat list diffs.
|
com.google.webrisk.v1beta1.ComputeThreatListDiffResponse |
computeThreatListDiff(com.google.webrisk.v1beta1.ThreatType threatType,
ByteString versionToken,
com.google.webrisk.v1beta1.ComputeThreatListDiffRequest.Constraints constraints)
Gets the most recent threat list diffs.
|
UnaryCallable<com.google.webrisk.v1beta1.ComputeThreatListDiffRequest,com.google.webrisk.v1beta1.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() |
com.google.webrisk.v1beta1.SearchHashesResponse |
searchHashes(ByteString hashPrefix,
List<com.google.webrisk.v1beta1.ThreatType> threatTypes)
Gets the full hashes that match the requested hash prefix.
|
com.google.webrisk.v1beta1.SearchHashesResponse |
searchHashes(com.google.webrisk.v1beta1.SearchHashesRequest request)
Gets the full hashes that match the requested hash prefix.
|
UnaryCallable<com.google.webrisk.v1beta1.SearchHashesRequest,com.google.webrisk.v1beta1.SearchHashesResponse> |
searchHashesCallable()
Gets the full hashes that match the requested hash prefix.
|
com.google.webrisk.v1beta1.SearchUrisResponse |
searchUris(com.google.webrisk.v1beta1.SearchUrisRequest request)
This method is used to check whether a URI is on a given threatList.
|
com.google.webrisk.v1beta1.SearchUrisResponse |
searchUris(String uri,
List<com.google.webrisk.v1beta1.ThreatType> threatTypes)
This method is used to check whether a URI is on a given threatList.
|
UnaryCallable<com.google.webrisk.v1beta1.SearchUrisRequest,com.google.webrisk.v1beta1.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 com.google.webrisk.v1beta1.ComputeThreatListDiffResponse computeThreatListDiff(com.google.webrisk.v1beta1.ThreatType threatType, ByteString versionToken, com.google.webrisk.v1beta1.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
- Required. 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
- The constraints associated with this request.ApiException
- if the remote call failspublic final com.google.webrisk.v1beta1.ComputeThreatListDiffResponse computeThreatListDiff(com.google.webrisk.v1beta1.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.ApiException
- if the remote call failspublic final UnaryCallable<com.google.webrisk.v1beta1.ComputeThreatListDiffRequest,com.google.webrisk.v1beta1.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 com.google.webrisk.v1beta1.SearchUrisResponse searchUris(String uri, List<com.google.webrisk.v1beta1.ThreatType> threatTypes)
Sample code:
try (WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = WebRiskServiceV1Beta1Client.create()) {
String uri = "";
List<ThreatType> threatTypes = new ArrayList<>();
SearchUrisResponse response = webRiskServiceV1Beta1Client.searchUris(uri, threatTypes);
}
uri
- The URI to be checked for matches.threatTypes
- Required. The ThreatLists to search in.ApiException
- if the remote call failspublic final com.google.webrisk.v1beta1.SearchUrisResponse searchUris(com.google.webrisk.v1beta1.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.ApiException
- if the remote call failspublic final UnaryCallable<com.google.webrisk.v1beta1.SearchUrisRequest,com.google.webrisk.v1beta1.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 com.google.webrisk.v1beta1.SearchHashesResponse searchHashes(ByteString hashPrefix, List<com.google.webrisk.v1beta1.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.ApiException
- if the remote call failspublic final com.google.webrisk.v1beta1.SearchHashesResponse searchHashes(com.google.webrisk.v1beta1.SearchHashesRequest request)
Sample code:
try (WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = WebRiskServiceV1Beta1Client.create()) {
SearchHashesRequest request = SearchHashesRequest.newBuilder().build();
SearchHashesResponse response = webRiskServiceV1Beta1Client.searchHashes(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.webrisk.v1beta1.SearchHashesRequest,com.google.webrisk.v1beta1.SearchHashesResponse> searchHashesCallable()
Sample code:
try (WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = WebRiskServiceV1Beta1Client.create()) {
SearchHashesRequest request = SearchHashesRequest.newBuilder().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 BackgroundResource
public boolean isShutdown()
isShutdown
in interface BackgroundResource
public boolean isTerminated()
isTerminated
in interface BackgroundResource
public void shutdownNow()
shutdownNow
in interface BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.