pub struct WebRiskService { /* private fields */ }Expand description
Implements a client for the Web Risk API.
§Example
let client = WebRiskService::builder().build().await?;
// use `client` to make requests to the Web Risk API.§Service Description
Web Risk API defines an interface to detect malicious URLs on your website and in client applications.
§Configuration
To configure WebRiskService use the with_* methods in the type returned
by builder(). The default configuration should
work for most applications. Common configuration changes include
- with_endpoint(): by default this client uses the global default endpoint
(
https://webrisk.googleapis.com). Applications using regional endpoints or running in restricted networks (e.g. a network configured override this default. - with_credentials(): by default this client uses Application Default Credentials. Applications using custom authentication may need to override this default.
§Pooling and Cloning
WebRiskService holds a connection pool internally, it is advised to
create one and the reuse it. You do not need to wrap WebRiskService in
an Rc or Arc to reuse it, because it
already uses an Arc internally.
Implementations§
Source§impl WebRiskService
impl WebRiskService
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Returns a builder for WebRiskService.
let client = WebRiskService::builder().build().await?;Sourcepub fn from_stub<T>(stub: T) -> Selfwhere
T: WebRiskService + 'static,
pub fn from_stub<T>(stub: T) -> Selfwhere
T: WebRiskService + 'static,
Creates a new client from the provided stub.
The most common case for calling this function is in tests mocking the client’s behavior.
Sourcepub fn compute_threat_list_diff(&self) -> ComputeThreatListDiff
pub fn compute_threat_list_diff(&self) -> ComputeThreatListDiff
Gets the most recent threat list diffs. These diffs should be applied to a local database of hashes to keep it up-to-date. If the local database is empty or excessively out-of-date, a complete snapshot of the database will be returned. This Method only updates a single ThreatList at a time. To update multiple ThreatList databases, this method needs to be called once for each list.
Sourcepub fn search_uris(&self) -> SearchUris
pub fn search_uris(&self) -> SearchUris
This method is used to check whether a URI is on a given threatList. Multiple threatLists may be searched in a single query. The response will list all requested threatLists the URI was found to match. If the URI is not found on any of the requested ThreatList an empty response will be returned.
Sourcepub fn search_hashes(&self) -> SearchHashes
pub fn search_hashes(&self) -> SearchHashes
Gets the full hashes that match the requested hash prefix. This is used after a hash prefix is looked up in a threatList and there is a match. The client side threatList only holds partial hashes so the client must query this method to determine if there is a full hash match of a threat.
Sourcepub fn create_submission(&self) -> CreateSubmission
pub fn create_submission(&self) -> CreateSubmission
Creates a Submission of a URI suspected of containing phishing content to be reviewed. If the result verifies the existence of malicious phishing content, the site will be added to the Google’s Social Engineering lists in order to protect users that could get exposed to this threat in the future. Only allowlisted projects can use this method during Early Access. Please reach out to Sales or your customer engineer to obtain access.
Sourcepub fn submit_uri(&self) -> SubmitUri
pub fn submit_uri(&self) -> SubmitUri
Submits a URI suspected of containing malicious content to be reviewed. Returns a google.longrunning.Operation which, once the review is complete, is updated with its result. You can use the [Pub/Sub API] (https://cloud.google.com/pubsub) to receive notifications for the returned Operation. If the result verifies the existence of malicious content, the site will be added to the [Google’s Social Engineering lists] (https://support.google.com/webmasters/answer/6350487/) in order to protect users that could get exposed to this threat in the future. Only allowlisted projects can use this method during Early Access. Please reach out to Sales or your customer engineer to obtain access.
§Long running operations
This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.
Sourcepub fn list_operations(&self) -> ListOperations
pub fn list_operations(&self) -> ListOperations
Provides the Operations service functionality in this service.
Sourcepub fn get_operation(&self) -> GetOperation
pub fn get_operation(&self) -> GetOperation
Provides the Operations service functionality in this service.
Sourcepub fn delete_operation(&self) -> DeleteOperation
pub fn delete_operation(&self) -> DeleteOperation
Provides the Operations service functionality in this service.
Sourcepub fn cancel_operation(&self) -> CancelOperation
pub fn cancel_operation(&self) -> CancelOperation
Provides the Operations service functionality in this service.
Trait Implementations§
Source§impl Clone for WebRiskService
impl Clone for WebRiskService
Source§fn clone(&self) -> WebRiskService
fn clone(&self) -> WebRiskService
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more